[Python-Dev] ',' precedence in documentation

Brett Cannon brett at python.org
Sun Sep 14 22:36:26 CEST 2008


On Sun, Sep 14, 2008 at 1:06 PM, Benjamin Peterson
<musiccomposition at gmail.com> wrote:
> On Sun, Sep 14, 2008 at 3:00 PM, Guido van Rossum <guido at python.org> wrote:
>>
>> I think in general Python has erred on the side of having too many
>> different syntactical uses for commas. We killed a few in 3.0 with the
>> introduction of "except E as v" and the demotion of print to a
>> function call. Perhaps we should aim to kill "assert B, S" as well?
>
> And replace it with what?
>

That's the question being posed. =)

A quick browsing of the grammar shows us already using 'in', 'as',
'from', and 'else' as keywords that are keywords which are not
statements as their own ('in' is unique, as Guido pointed out because
of its use with 'for' and as an operator).

Something like ``assert _expr_ else _message_`` might work, but I am
not sure if people will misunderstand the meaning of 'else'. But if
does somewhat match the usage with 'if' expressions as the expression
following is not executed if the preceding expression is true.

-Brett


More information about the Python-Dev mailing list