why cannot assign to function call

rurpy at yahoo.com rurpy at yahoo.com
Thu Jan 8 20:24:25 EST 2009


Mark Wooding wrote:
...
> Python doesn't need another name for assignment,

OK.

> because actually its
> idea of assignment is the same as anyone else's.  The difference is in
> the way it deals with objects.  See argument elsewhere.

"the same as anyone else's" only if [Python's] "idea
of assignment" does not include producing the same
results.

  a = array (1,2,3)
  b = a
  a[1] = 4
  print b

C, C++, VBA, Fortran, Perl:  1, 2, 3
Python:  1, 4, 3

Telling someone coming to Python from one of those
languages that Python's assignment works the same way
as those languages is confusing at best.  "dealing
objects" is part of assignment semantics ISTM.





More information about the Python-list mailing list