Favorite non-python language trick?

Terry Hancock hancock at anansispaceworks.com
Mon Jun 27 06:22:00 CEST 2005


On Sunday 26 June 2005 06:11 am, Robert Kern wrote:
> Terry Hancock wrote:
> > On Sunday 26 June 2005 05:39 am, Torsten Bronger wrote:
> >>However, then you must forbid a=b=1 for assigning to two variables
> >>at the same time.
> 
> You need to differentiate
>    a = b = 1
> from
>    a = b == 1

Okay, I see what you mean.  I can't ever recall having needed the
second form, though.

Of course, you could still do assignment like this:

a, b = (1,)*2

But I guess that's not exactly elegant. ;-)

--
Terry Hancock ( hancock at anansispaceworks.com )
Anansi Spaceworks  http://www.anansispaceworks.com




More information about the Python-list mailing list