Why assert is not a function?

Greg Ewing greg.ewing at canterbury.ac.nz
Tue Mar 2 22:02:10 EST 2021


On 3/03/21 12:24 pm, Chris Angelico wrote:
> if PRODUCTION:
>      def assert(*a, **kw): pass
> 
> would work if it were a function :)

But would cost you a useless function call for every assert
in production mode.

-- 
Greg



More information about the Python-list mailing list