A small inconsistency in syntax?

Rainer Deyke root at rainerdeyke.com
Fri Oct 26 19:45:34 CEST 2001

"Chris Barker" <chrishbarker at home.net> wrote in message
news:3BD995CB.22D3507A at home.net...
> Terry Reedy wrote:
> > As I understand it, the rule is this:  if item on LHS is tuple rather
> > than name, then corresponding object on RHS must be a tuple, which
> > will then be seen as collection rather than object in itself and
> > consequently unpacked for matching to items within LHS tuple.
> > Allowing for null matches and applying the rule recursively,
> Actually either side can be a sequence, not just a tuple:

Nitpick: Although the LHS can be written as either a tuple literal or a list
literal, it is in fact not an object at all, and hence not a tuple, list, or
any other kind of sequence:

a, b = 3, 4  # a <- 3; b <- 4
a_b = a, b
a_b = 3, 4 # Does not affect the value of 'a' or 'b'.
tuple((a, b)) = 3, 4 # Syntax error.

Rainer Deyke (root at rainerdeyke.com)
Shareware computer games           -           http://rainerdeyke.com
"In ihren Reihen zu stehen heisst unter Feinden zu kaempfen" - Abigor

More information about the Python-list mailing list