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.

What is weird -- to me ;-) -- is using side-effects in either example above.

--
Terry Jan Reedy

_______________________________________________
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