[Python-ideas] Repurpose `assert' into a general-purpose check

Ivan Pozdeev vano at mail.mipt.ru
Mon Nov 27 21:28:10 EST 2017

On 28.11.2017 5:19, Chris Angelico wrote:

> Actually, Python does have a way of disabling assertions (the -O
> flag), so they should be treated the same way they are in C.
> Assertions should not be used as shorthands for "if cond: raise Exc"
> in the general case.
I'm claiming, and provided evidence, that there are no use cases for 
this in Python, so no-one (of any significance) will suffer when the 
disabling is cut out.
In any case, we will probably do it with a __future__ statement for a 
transitional period.


More information about the Python-ideas mailing list