assignment in control structure syntax (was Re: Curious assignment behaviour)
Chris Dutton
chris at cmb-enterprises.com
Sat Oct 13 00:53:34 EDT 2001
in article 7xlmiivbnj.fsf at ruckus.brouhaha.com, Paul Rubin at
phr-n2001d at nightsong.com wrote on 10/11/01 4:11 AM:
> Chris Dutton <chris at cmb-enterprises.com> writes:
>> The example I saw somewhere that I liked was
>>
>> if something as x:
>> do_something_to(x)
>
> That's ok too, as long as the comparison doesn't have to be with zero:
> if (something as x) == 3:
> do_something_to(x)
Just occurred to me, this kind of aliasing could be helpful elsewhere. Say
in list comprehensions perhaps?
More information about the Python-list
mailing list