logic behind the assert syntax?
Thomas Wouters
thomas at xs4all.net
Tue Aug 29 04:03:23 EDT 2000
On Tue, Aug 29, 2000 at 01:37:59AM +0200, Niels Diepeveen wrote:
> >>> assert 0 == 1, 2, 3
> SyntaxError: invalid syntax
> Not really what I'd expect, going by the language reference.
Hmm.
assert_statement: "assert" expression ["," expression]
That's pretty obvious to me: it only takes a single comma. And note that the
last expressions is an 'expression', *not* an expression_list. This means
that it has to be a single expression, and if you want it to be a list of
expressions, you need to make it a single expression by adding parentheses.
(You can look up the definitions of 'expression' and 'expression_list' in the
sections 5.10 and 5.11)
--
Thomas Wouters <thomas at xs4all.net>
Hi! I'm a .signature virus! copy me into your .signature file to help me spread!
More information about the Python-list
mailing list