Mitchell Model <m...@acm.org> added the comment: I've read those paragraphs many times. Oddly enough when you asked me for a rewording and I went back and read them again I found a very different interpretation than all the other times. I've always thought of unpacking as being about the variables on the left rather than the values on the right.
Now that I am rethinking this I realize (a) that unpacking is always about both sides of the assignment and (b) the wording I criticized is actually precise and accurate, if a bit subtle. What I noticed this time is that "the sequence" in the sentence beginning "Sequence unpacking" refers to the sequence on the right, not the variables on the left, especially since "the variables on the left" are mentioned earlier in the sentence. Part of how I backed into the wrong corner with this is that the left- hand side of an unpacking can be a list as well as a tuple. I was checking to see if any other kinds of sequences could go on the left, which of course they can't. That's why I thought "works for any sequence" was wrong. If only a tuple could be on the left I think I would have realized what this was saying sooner. It was the fact that more than one kind of sequence could go on the left that got be sidetracked. Moreover, the example shows a target list and doesn't even show an explicit tuple or a list. So, it's being fairly informal, as is appropriate for a tutorial. However, with all that sorted out I now see a different problem: "multiple assignment is really just a combination of tuple packing and sequence unpacking". If there is an explicit tuple, or a list, on the left-hand side then there's no packing involved. In fact it's rather strange that one could put something like [x,y,z] on the left-hand side of the assignment. I suppose it must get converted during compilation to a tuple for multiple assignment -- it's not as if a list-valued variable could go there. Sorry about the long-winded meditation. Hope the exploration proves interesting and or valuable to someone! _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue5018> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com