Neville Grech Neville Grech wrote: > This reminds me a lot of haskell/prolog's head/tail list splitting. Looks > like a good feature.
Agreed! > a*=range(5) > hmmn maybe in such a case, whenever there is the * operator, the resulting > item is always a list/tuple, like the following: > a=[[0,1,2,3,4]] ? Did you mean *a = range(5)? The result is too surprising for me. I would suspect that *a = range(5) has the same output as a = range(5). >>> *b = (1, 2, 3) >>> b (1, 2, 3) >>> a, *b = (1, 2, 3) >>> a, b 1, (2, 3) >>> *b, c = (1, 2, 3) >>> b, c (1, 2), 3 >>> a, *b, c = (1, 2, 3) >>> a, b, c 1, (2,), 3 But what would happen when the right side is too small? >>> a, *b, c = (1, 2) >>> a, b, c 1, (), 2 or should it raise an unpack exception? This should definitely raise an exception >>> a, *b, c, d = (1, 2) Christian _______________________________________________ Python-3000 mailing list Python-3000@python.org http://mail.python.org/mailman/listinfo/python-3000 Unsubscribe: http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com