The closest you may ever get to something like this is a clean separation
of -O flags instead of the current -O/-OO options. That way you can flip on
everything *but* assertion removal. But a per-file directive I don't see
happening, and even the flag separation has never caught on enough for
anyone to put in the effort to get a PoC working since the only people who
ask for this are people wanting permanent asserts and that leads the usual
"you're doing it wrong" comments. Probably best/only way to motivate it is
to open up -O in a way to allow for more optimizations, but once again
that's a lot of work.

On Sun, May 17, 2020 at 2:08 PM Alex Hall <alex.moj...@gmail.com> wrote:

> Some people (like myself, or the coworkers of [this person](
> https://mail.python.org/archives/list/python-ideas@python.org/thread/PLXOXKACKGXN4ZKISDVXLKMFIETWTF63/))
> just like to use asserts as a convenient way to check things. We don't want
> asserts to ever be turned off. Maybe there could be some kind of compiler
> directive which means "in this file, even with -O, keep the asserts". Maybe
> the line `assert __debug__`?
> _______________________________________________
> Python-ideas mailing list -- python-ideas@python.org
> To unsubscribe send an email to python-ideas-le...@python.org
> https://mail.python.org/mailman3/lists/python-ideas.python.org/
> Message archived at
> https://mail.python.org/archives/list/python-ideas@python.org/message/TQKXSCMH7JYCHAE3XN7MCSWVA2UJ4R5G/
> Code of Conduct: http://python.org/psf/codeofconduct/
>
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/W7BNFTTJZ56NKGLEIBQGQVOGFAXZWUUK/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to