A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2012-November/122598.html below:

[Python-Dev] chained assignment weirdity

[Python-Dev] chained assignment weirdity [Python-Dev] chained assignment weirdityNed Batchelder ned at nedbatchelder.com
Thu Nov 8 02:11:21 CET 2012
On 11/7/2012 5:11 PM, Terry Reedy wrote:
> On 11/7/2012 4:39 PM, Ned Batchelder wrote:
>
>> Just to be clear: the reference guide says that the behavior *SHOULD BE*
>> (but is not yet) this:
>>
>>     Python 3.3.0
>>      >>> {print("a"):print("b")}
>>     a
>>     b
>>     {None: None}
>>      >>> d = {}
>>      >>> d[print("a")] = print("b")
>>     b
>>     a
>>      >>>
>>
>> Is this or is this not "weird" to you?
>
> Not weird. Expressions and assignment targets are each consistently 
> evaluated left to right (except as *necessarily* alter by precedence), 
> with expressions evaluated before targets.
>
Sorry, I should have been clearer: I was asking about weird not to say, 
"This is weird and should be changed!", but to get clarification from 
Serhiy about his statement, " It will be weird if a dict comprehension 
and a plain loop will be inconsistent."  I honestly didn't know which 
behavior he considered inconsistent and therefore weird.

--Ned.

More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4