[Python-Dev] Tuple/list assignment question (original) (raw)
Delaney, Timothy C (Timothy) tdelaney at avaya.com
Wed Aug 4 07:07:42 CEST 2004
- Previous message: [Python-Dev] Weekly Python Bug/Patch Summary
- Next message: [Python-Dev] Tuple/list assignment question
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Dave Cole wrote:
Is there any reason why something like this would not be a good idea?
>>> alist = [1, 2, 3, 4, 5] >>> a, b, *c = alist 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: ...
This proposal has come up several times before (for the record, I like it). I believe there was a particular reason it's never gone forward, but I can't remember what it was. Unfortunately, it's not an easy thing to search for in the c.l.py archives :(
I think it's about time this proposal got a PEP of its own ... something like "Enhanced Tuple Unpacking" (to match "Enhanced Argument Tuples" ...
Tim Delaney
- Previous message: [Python-Dev] Weekly Python Bug/Patch Summary
- Next message: [Python-Dev] Tuple/list assignment question
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]