why no ++?
Michael Abbott
michael at rcp.co.uk
Tue Aug 14 03:32:43 EDT 2001
Duncan Booth <duncan at NOSPAMrcp.co.uk> wrote in
news:Xns90FC6932FB561duncanrcpcouk at 127.0.0.1:
> Michael Abbott <michael at rcp.co.uk> wrote in
> news:Xns90FC57863FF5michaelrcpcouk at 194.238.50.13:
>
>>> It's the same as
>>>>>> a = (b,c,d) = e = 'wow'
>>>
>>
>> I would say that the criminal obfuscation here comes from the ability
>> to perform more than one assignment in a sequence; this is almost as
>> bad as treating an assignment as an expression. If we write this as
>>
>> e = 'wow'
>> b,c,d = e
>> a = b,c,d
>>
>> then it's quite clear what's going on. (It's just a=b=c etc I'm
>> grumbling about here.)
>>
> Except that your rewriting has a different effect. In the first case a
> ends up with the same value as e, whereas your 'expanded' version gives
> e=='wow' and a==('w','o','w')
>
>
Oops! Very true. I should have rewritten it as
e = 'wow'
b,c,d = 'wow'
a = 'wow'
Hmm. The argument about obfuscation versus repetition comes more clearly
into focus. I still think multiple assignment is a bad thing...
More information about the Python-list
mailing list