Suggestions for 2002

Paul Rubin phr-n2002a at nightsong.com
Sun Jan 13 02:20:18 EST 2002


Richard Jones <richardjones at optushome.com.au> writes:
> > Oops, lemme try again.  The idea is that a,b=c,d is supposed to
> > simulate doing the assignments in parallel.  So I'd expect a,b = c,d
> > to work as something like (using C-style pointer notation):
> 
> ... having to resort to using a pointer notation merely reinforces
> my feeling that you're not thinking about the problem in a very
> Pythonesque way. Python doesn't have the pointer/scalar split that
> other languages seem so burdened by (hello, C and *blech*
> Perl). There's just labels on values. The left hand side of an
> assignment operation defines what labels are being applied to the
> right hand side of an operation. No pointers, no magic...

That a,b=c,d produces such an unexpected result in Python suggests that
the Pythonesque way is not always optimal.

Note that the Python designers found it worthwhile to add the weak reference
module to allow breaking out of the Pythonesque model.  I'm not sure if
you can do a,b=c,d as I proposed using weak references instead of pointers.




More information about the Python-list mailing list