Python 3000 idea: reversing the order of chained assignments

Marcin Ciura marcin.ciura at poczta.NOSPAMonet.pl
Wed Mar 21 22:53:55 CET 2007


Given
   class Node(object):
       pass

   node = Node()
   nextnode = Node()

I tried to refactor the following piece of code
   node.next = nextnode
   node = nextnode

as
   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. From the user's perspective,
I can't think of any reasonable argument for keeping it
this way in Python 3000. What is your opinion?
   Marcin



More information about the Python-list mailing list