[Python-3000] PEP 3132: Extended Iterable Unpacking (original) (raw)
Daniel Stutzbach daniel at stutzbachenterprises.com
Sat May 5 03:44:03 CEST 2007
- Previous message: [Python-3000] PEP 3132: Extended Iterable Unpacking
- Next message: [Python-3000] PEP 3132: Extended Iterable Unpacking
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 5/4/07, Greg Ewing <greg.ewing at canterbury.ac.nz> wrote:
I don't think that returning the type given is a goal that should be attempted, because it can only ever work for a fixed set of known types. Given an arbitrary sequence type, there is no way of knowing how to create a new instance of it with specified contents.
For objects that support the sequence protocol, how about specifying that:
a, *b = container_object
must be equivalent to:
a, b = container_object[0], container_object[1:]
That way, b is assigned whatever container_object's getslice method returns. A list will return a list, a tuple will return a tuple, and widgets (or BLists...) can return whatever makes sense for them.
-- Daniel Stutzbach, Ph.D. President, Stutzbach Enterprises LLC
- Previous message: [Python-3000] PEP 3132: Extended Iterable Unpacking
- Next message: [Python-3000] PEP 3132: Extended Iterable Unpacking
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]