PEP new assert idiom

John Roth newsgroups at jhrothjr.com
Sun Nov 7 13:27:44 EST 2004


"Fábio Mendes" <niels_bohr at uol.com.br> wrote in message 
news:mailman.6028.1099792711.5135.python-list at python.org...
>> I see two difficulties with it.
>>
>> First, you can do the same thing (I think) with a
>> try block around a sequence of statements and
>> an assert in the except block. This means you
>> will need a fairly strong use case based on
>> convenience to add the syntax to the language.
>> You will have to show that it will be used a lot.
>
> I meant expression instead of statement, sorry, that's my fault. It's a
> minor cosmetic change I should say, only to avoid long grouping of
> expressions with an 'and' operator. It's better expressed as: let the
> commas take the place of 'and' in assertion verifications... Maybe that
> could be extended to other parts of the language, but the only place I
> think it would be useful is in assertion statements.

I see. That might have a syntactic difficulty, though, since the
comma is already in use as the tuple constructor operator.

John Roth
>
> Thanks,
> Fabio 




More information about the Python-list mailing list