[Python-Dev] ',' precedence in documentation]

Joel Bender jjb5 at cornell.edu
Mon Sep 15 17:14:10 CEST 2008

Guido van Rossum wrote:

> ...the syntax for "expression" doesn't allow a comma unless
> it's inside parentheses.

Perhaps a source of confusion might be that comma seems to act like a 
'tuple join operator' when it is not inside parentheses.

     >>> x = 1, 2
     >>> x
     (1, 2)

And there is at least one point in the documentation where the comma is 
described as an operator:


     "Note that tuples are not formed by the parentheses, but rather
     by use of the comma operator."

As for the assert syntax, I would reuse the 'raise' keyword rather than 

     assert_stmt ::= "assert" <expression> [ "raise" <expression> ]

Which emphasizes that the expression is raised as an exception.


More information about the Python-Dev mailing list