On 2021-03-02, Chris Angelico <ros...@gmail.com> wrote: > On Wed, Mar 3, 2021 at 10:22 AM Mirko via > Python-list><python-list@python.org> wrote: > >> In production code you don't want any asserts, but logging. Having >> "assert" being a function would make it much harder to get rid of >> it in production code. > > Really? > > if PRODUCTION: > def assert(*a, **kw): pass > > would work if it were a function :)
Wouldn't that still evaluate all of the arguments? You get rid of the value of the assert, but retain almost all of the cost. I thought the entire point of asser being a keyword was so that if you disable asserts then they go away completely: the arguments aren't even evaluated. -- Grant -- https://mail.python.org/mailman/listinfo/python-list