unpacking lists (there's more than one way to do it!)
Roy Smith
roy at panix.com
Tue Jan 15 22:15:29 EST 2002
Philip Swartzleonard <starx at pacbell.net> wrote:
> Well, 3 lets you know that the person wants to be working with a list...
I often use the [] construct when unpacking a long list:
class foo:
def __init__ (self, values):
[self.a,
self.b,
self.c,
self.d,
self.e,
self.f,
self.g] = values
If I left out the []'s, I'd have to put \'s at the end of each line, which
I find rather ugly.
More information about the Python-list
mailing list