what does 'a=b=c=[]' do
Steven D'Aprano
steve+comp.lang.python at pearwood.info
Wed Dec 21 18:48:30 EST 2011
On Wed, 21 Dec 2011 18:20:16 -0500, Dennis Lee Bieber wrote:
> For the amount of typing, it's easier to just do a straight line
> tuple unpack
>
>>>> a,b,c = ([],[],[])
Note that tuples are created by the comma, not the round brackets (or
parentheses for any Americans reading). So the round brackets there are
strictly redundant:
a, b, c = [], [], []
The only times you need the brackets around a tuple is to control the
precedence of operations, or for an empty tuple.
--
Steven
More information about the Python-list
mailing list