[Python-Dev] Tuple/list assignment question

Dave Cole djc at object-craft.com.au
Tue Aug 3 08:44:53 CEST 2004


Is there any reason why something like this would not be a good idea?

 >>> a_list = [1, 2, 3, 4, 5]
 >>> a, b, *c = a_list

You could then do things like this:

 >>> lol = [[1, 2], [3, 4, 5, 6, 7], [8, 9, 10, 11, 12, 13]]
 >>> for a, b *c in lol:
...

- Dave

-- 
http://www.object-craft.com.au


More information about the Python-Dev mailing list

Follow Lee on X/Twitter - Father, Husband, Serial builder creating AI, crypto, games & web tools. We are friends :) AI Will Come To Life!

Check out: eBank.nz (Art Generator) | Netwrck.com (AI Tools) | Text-Generator.io (AI API) | BitBank.nz (Crypto AI) | ReadingTime (Kids Reading) | RewordGame | BigMultiplayerChess | WebFiddle | How.nz | Helix AI Assistant