what does 'a=b=c=[]' do

Steven D'Aprano steve+comp.lang.python at pearwood.info
Sun Dec 25 08:16:00 EST 2011


On Sat, 24 Dec 2011 19:41:55 +0100, Thomas Rachel wrote:

>> The only times you need the brackets around a tuple is to control the
>> precedence of operations, or for an empty tuple.
> 
> IBTD:
> 
> a=((a, b) for a, b, c in some_iter)
> b=[(1, c) for <whatever>]
> 
> Without the round brackets, it is a syntax error.

Correction noted.

Nevertheless, the parentheses don't create the tuple, the comma operator 
does.



-- 
Steven



More information about the Python-list mailing list