a = b = 1 just syntactic sugar?
Steven Taschuk
staschuk at telusplanet.net
Mon Jun 9 03:31:49 EDT 2003
Quoth Ed Avis:
> martin at v.loewis.de (Martin v. =?iso-8859-15?q?L=F6wis?=) writes:
[...]
> >Elsewhere in the thread I have said that this interpretation is
> >incorrect: a simple_stmt always ends with a NEWLINE, something which
> >you apparently don't want.
>
> And yet elsewhere I have replied citing the definition of simple_stmt
> from <http://python.org/doc/current/ref/grammar.txt>, which seems to
> show that simple_stmt does not end with a NEWLINE.
Sheesh!
Language Reference:
statement ::= stmt_list NEWLINE | compound_stmt
stmt_list ::= simple_stmt (";" simple_stmt)* [";"]
simple_stmt ::= expression_stmt | assert_stmt ...
No NEWLINE in simple_stmt, like Ed says.
Grammar/Grammar:
stmt: simple_stmt | compound_stmt
simple_stmt: small_stmt (';' small_stmt)* [';'] NEWLINE
small_stmt: expr_stmt | print_stmt ...
NEWLINE in simple_stmt, like Martin says.
Using the terms and syntax of Grammar/Grammar, Ed's proposal was
to replace
lambdef: 'lambda' [varargslist] ':' test
with
lambdef: 'lambda' [varargslist] ':' small_stmt
--
Steven Taschuk 7\ 7'Z {&~ .
staschuk at telusplanet.net Y r --/hG-
(__/ )_ 1^1`
More information about the Python-list
mailing list