why no ++?

Michael Abbott michael at rcp.co.uk
Mon Aug 13 09:33:55 CEST 2001

Ben Wolfson <rumjuggler at cryptarchy.org> wrote in
news:kv9bnts4r490khlfv4fpenhshbe3j8pqlb at 4ax.com: 

> On Sat, 11 Aug 2001 23:37:52 +0100, Stefan Schwarzer
> <s.schwarzer at ndh.net> wrote:
>>Alex Martelli schrieb:
>>>     a=b,c,d=e='wow'
>>Nice, but seems like "obfuscated Python" to me ;-)
>>>>> a,b,c,d,e
>>('wow', 'w', 'o', 'w', 'wow')
>>I haven't yet figured out how it works. Could you please add
>>parantheses to the above expression or clarify otherwise how it works? 
> 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.)

More information about the Python-list mailing list