On Mon, Apr 16, 2018 at 11:05 PM, Mikhail V <mikhail...@gmail.com> wrote: > Lets just return to some of proposed examples > (I use "=" in both examples to be less biased here): > > 1. > if ( match = re.match("foo", S) ) == True: > print("match:", match) > > 2. > if ( re.match("foo", S) = match ) == True: > print("match:", match) > > > Now seriously, you may argue around those "pronounce" > theoretical bla bla, like "take the result and save it in a token". > But the variant 1. is just better, because _it is what it is in Python_.
You start by attempting to be less biased, but you're using existing Python syntax and then justifying one of the two options because it's existing Python syntax. I'm not sure that that's a strong argument :) > So it is better not because it is better looking or whatever, > it is same sh** turned around. So just don't turn it around! Obviously if the chosen token is ":=", it's going to be target first. > When I read code I don't have all those things > you describe in a millisecond : > - look at the pointy end of operator > - think, oh this shows to the right > - seems like I save the value there > - yep, that's the way I imply things to work > - stroking the belly > .... > > Instead I just parse visually some smaller parts > of code and it's just better if the assignment is in the same > order as everywhere. > Yes, in some single case one order can look better, > but in this case it's just not good to mix those. Here are the three most popular syntax options, and how each would be explained: 1) "target := expr" ==> It's exactly the same as other forms of assignment, only now it's an expression. 2) "expr as name" ==> It's exactly the same as other uses of "as", only now it's just grabbing the preceding expression, not actually doing anything with it 3) "expr -> name" ==> The information went data way. So either you take a parallel from elsewhere in Python syntax, or you take a hopefully-intuitive dataflow mnemonic symbol. Take your pick. ChrisA _______________________________________________ Python-ideas mailing list Pythonemail@example.com https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/