[Tutor] Is there any logic in this?
Alan Gauld
alan.gauld at btinternet.com
Sun Sep 2 00:17:10 CEST 2007
"jim stockford" <jim at well.com> wrote
> your example is interesting, but reading right to left
> doesn't work well, which bothers me.
It works OK if you treat the entire right hand side as an
expression that evaluates to a value which is bound to
the name on the left.
In the list cae the sort method works in-place so the
list object never changes.
In the integer case two integers get added together
to make a new integer. The new value is bound to the name.
> I hate not being able to read from right to left in a
> procrustean manner. The compromise is read the
> right side of the "assignment" operator and then
> the left side and do what common sense expects.
You can read from right to left but you just have to
do it under the rules of Python :-)
Alan G.
More information about the Tutor
mailing list