destructuring tuple and list

Sebastien de Menten sdementen at hotmail.com
Wed Mar 17 02:34:27 EST 2004


Hi,

Is there a reason to not extend the tuple destructuration in functions
to any expression ?
For instance, we can:
	def f(x, y, *tail):
		return tail + (x,y)
	f(3,4,5,6) -> (5,6,3,4)
or
	f(*(3,4,5,6)) -> idem

But I can't do:
	(x,y, *tail) = (3,4,5,6)
and get
	x=3
	y=4
	tail = (5,6)
Same question for lists...

Thank you
Sebastien



More information about the Python-list mailing list