[Python-3000] Using *a for packing in lists and other places
Terry Reedy
tjreedy at udel.edu
Mon Mar 17 23:37:05 CET 2008
"Marcin 'Qrczak' Kowalczyk" <qrczak at knm.org.pl> wrote in message
news:1205751413.13377.11.camel at qrnik...
| Dnia 16-03-2008, N o godzinie 18:20 -0400, Terry Reedy pisze:
|
| > The rule I suggested is 'execute the statement the same *as if* the
| > iterable items had been written in the code as a comma sequence'.
|
| One reason I don't like this rule is that it works on the level of the
| token sequence
The tokenization of Python code is part of the language spec
| rather than the AST.
Whereas no particular AST is, that I know of.
| It's too low-level, relying on
| peculiarities of the syntax rather than the meaning (does a=*b really
| convert b to a tuple only because the tuple syntax uses lone commas?).
| And it doesn't directly work for 0 or 1 items, in which case the
| behavior must be extrapolated from the behavior for more items.
Can you give another rule that you prefer and that I can comprehend and
that I can explain to Python newcomers? The OP only gave a few examples of
* usage and (initially) no rule that I saw.
More information about the Python-3000
mailing list