> Yes. Why is that surprising?
because you called it "tuple unpacking". Furthermore, because in functional languages where this feature comes from you actually unpack tuples, and pattern-matching of other structures is not called "tuple unpacking".
> I've always thought that the tuple referred to by 'tuple unpacking' was the target containing the variables being assigned
That's what the "tuple" is unpacked into, it makes no sense that the name of the pattern would come from there. At best and stretching it, you'd have "into-a-tuple unpacking". Furthermore, you're not actually unpacking into a tuple (even less so in Python 3, `(1, * a)` isn't a valid expression... anywhere that I know of), you're unpacking into free variables. That's the point of unpacking.
> because you frequently unpack things other than tuples.
The only other thing frequently unpacked is a list, and Python's tuples are immutable lists, it does not stretch the imagination that a read-only feature of tuples would work on their mutable cousin as well. As for other structures, in 6 years of Python I'd say I've seen unpacking of arbitrary iterators thrice at best. You do not frequently unpack dicts or iterators.
edit: fucking hell, yc's comment format sucks donkey balls.
I imagine a great many people will be "interested" in your response, then.
And really, you choose to be uncivil over a name? Arguing about names is one thing; insulting your opponent because he uses a different name than you do is just childish.
Anyway, since I can't seem to resist trollbait:
> because you called it "tuple unpacking".
It surprises you that historical terminology persists even a decade after limitations have been removed?
> Furthermore, because in functional languages where this feature comes from
Algol 60 had this feature under the name of "multiple assignment" I'll bet long before LISP had "destructuring-bind". This feature did not originate in functional languages.
> That's what the "tuple" is unpacked into, it makes no sense that the name of the pattern would come from there.
Prior to Python 1.5, the expression being unpacked had to be a tuple; now it does not. The name is derived from the original functionality. If you'd spent your effort referring to the Python Language Reference instead of telling the world how you can't fathom someone would use a different name than you would for this sort of assignment, you'd know this :)
> The only other thing frequently unpacked is a list, and Python's tuples are immutable lists
Python's tuples are not immutable lists. See http://mail.python.org/pipermail/python-dev/2003-March/03396... for Guido's own words saying it.
> edit: fucking hell, yc's comment format sucks donkey balls.
You could have saved yourself a lot of trouble and others (like myself) a lot of annoyance by simply not commenting.
The only other thing frequently unpacked is a list
Which isn't a tuple. You're the one trying to be pedantic, but you want to ding me for making this distinction?
it does not stretch the imagination that a read-only feature of tuples would work on their mutable cousin as well.
I agree, it doesn't. I don't see how it stretches the imagination that it works on general iterables, either.
Did you know that "tuple unpacking" actually works on arbitrary iterables (in fact, the relevant function in Python's C code is called ``unpack_iterable``)?
you should be careful with such declarations.