Lie Ryan wrote:
On Sun, 2009-02-15 at 21:29 +0100, tutor-requ...@python.org wrote:
Do you know about sequence unpacking? In an assignment statement, when
the right side is a sequence, the left side can be a list of variables
of the same length as the sequence. Then each sequence element is
assigned to one variable. For example
<nitpick>
The left side can only be a tuple of "names". The tuple unpacking is a
little bit of violation of python's object model, since while python's
tuple usually contain objects, in tuple unpacking the tuple contains a
list of names to be assigned.
</nitpick>
It's time to take a look at the Language Reference.
6.3 Assignment statements.
assignment_stmt ::= (target_list "=")+ expression_list
a target list is not a tuple, even though it can look like one.
So I don't see it as any violation.
--
Bob Gailer
Chapel Hill NC
919-636-4239
_______________________________________________
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor