why no ++?

Duncan Booth duncan at NOSPAMrcp.co.uk
Mon Aug 13 05:33:44 EDT 2001


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')


-- 
Duncan Booth                                             duncan at rcp.co.uk
int month(char *p){return(124864/((p[0]+p[1]-p[2]&0x1f)+1)%12)["\5\x8\3"
"\6\7\xb\1\x9\xa\2\0\4"];} // Who said my code was obscure?



More information about the Python-list mailing list