Python 3000 idea: reversing the order of chained assignments

Ben Finney bignose+hates-spam at benfinney.id.au
Wed Mar 21 18:24:33 EDT 2007


Marcin Ciura <marcin.ciura at poczta.NOSPAMonet.pl> writes:

>    node = node.next = nextnode
>
> only to discover that Python performs chained assignments
> backwards compared to other languages, i.e. left-to-right
> instead of right-to-left.

What makes you think so?

    >>> a = "foo"
    >>> b = "bar"
    >>> c = "baz"
    >>> a = b = c
    >>> a, b, c
    ('baz', 'baz', 'baz')

-- 
 \        "During my service in the United States Congress, I took the |
  `\                 initiative in creating the Internet."  -- Al Gore |
_o__)                                                                  |
Ben Finney




More information about the Python-list mailing list