Re: Filling in a tuple from unknown size list

2009-11-30 Thread John Machin
On Nov 27, 11:18 pm, boblatest wrote: > Hello all, > > (sorry for posting from Google. I currently don't have access to my > normal nntp account.) > > Here's my question: Given a list of onknown length, I'd like to be > able to do the following: > > (a, b, c, d, e, f) = list > > If the list has fe

Re: Filling in a tuple from unknown size list

2009-11-30 Thread Steven D'Aprano
On Fri, 27 Nov 2009 04:18:08 -0800, boblatest wrote: > Here's my question: Given a list of onknown length, I'd like to be able > to do the following: > > (a, b, c, d, e, f) = list > > If the list has fewer items than the tuple, I'd like the remaining tuple > elements to be set to "None". If the

Re: Filling in a tuple from unknown size list

2009-11-29 Thread Ned Deily
In article , inhahe wrote: > maybe that thing in python 3 that someone mentioned is the answer, but > otherwise i always think Python should admit something like this: > > a, b, c, *d = list > > i.e. if list were [1,2,3,4,5], you'd get a=1, b=2, c=3, d=[4, 5] Extended iterable unpacking (http

Re: Filling in a tuple from unknown size list

2009-11-29 Thread inhahe
On Sun, Nov 29, 2009 at 4:42 AM, inhahe wrote: > maybe that thing in python 3 that someone mentioned is the answer, but > otherwise i always think Python should admit something like this: > > a, b, c, *d = list > > i.e. if list were [1,2,3,4,5], you'd get a=1, b=2, c=3, d=[4, 5] > > not that that

Re: Filling in a tuple from unknown size list

2009-11-29 Thread inhahe
maybe that thing in python 3 that someone mentioned is the answer, but otherwise i always think Python should admit something like this: a, b, c, *d = list i.e. if list were [1,2,3,4,5], you'd get a=1, b=2, c=3, d=[4, 5] not that that solves the None problem, though i don't have any feature sugg

Re: Filling in a tuple from unknown size list

2009-11-27 Thread Stefan Behnel
Mel, 27.11.2009 18:47: > Steven D'Aprano wrote: >> On Fri, 27 Nov 2009 04:18:08 -0800, boblatest wrote: >>> Here's my question: Given a list of onknown length, I'd like to be able >>> to do the following: >>> >>> (a, b, c, d, e, f) = list >>> >>> If the list has fewer items than the tuple, I'd like

Re: Filling in a tuple from unknown size list

2009-11-27 Thread Mel
Steven D'Aprano wrote: > On Fri, 27 Nov 2009 04:18:08 -0800, boblatest wrote: >> Here's my question: Given a list of onknown length, I'd like to be able >> to do the following: >> >> (a, b, c, d, e, f) = list >> >> If the list has fewer items than the tuple, I'd like the remaining tuple >> elemen

Re: Filling in a tuple from unknown size list

2009-11-27 Thread Jon Clements
On 27 Nov, 12:18, boblatest wrote: > Hello all, > > (sorry for posting from Google. I currently don't have access to my > normal nntp account.) > > Here's my question: Given a list of onknown length, I'd like to be > able to do the following: > > (a, b, c, d, e, f) = list > > If the list has fewer

Re: Filling in a tuple from unknown size list

2009-11-27 Thread Dave Angel
Peter Otten wrote: boblatest wrote: Hello all, (sorry for posting from Google. I currently don't have access to my normal nntp account.) Here's my question: Given a list of onknown length, I'd like to be able to do the following: (a, b, c, d, e, f) = list If the list has fewer items than

Re: Filling in a tuple from unknown size list

2009-11-27 Thread Stefan Behnel
boblatest, 27.11.2009 13:18: > Here's my question: Given a list of onknown length, I'd like to be > able to do the following: > > (a, b, c, d, e, f) = list > > If the list has fewer items than the tuple, I'd like the remaining > tuple elements to be set to "None". If the list is longer, I'd like

Re: Filling in a tuple from unknown size list

2009-11-27 Thread Peter Otten
boblatest wrote: > Hello all, > > (sorry for posting from Google. I currently don't have access to my > normal nntp account.) > > Here's my question: Given a list of onknown length, I'd like to be > able to do the following: > > (a, b, c, d, e, f) = list > > If the list has fewer items than th