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.

_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to