05.05.18 15:54, Eloi Gaudry пише:
I meant avoiding the overhead of the expression evaluation enclosed in the
assert itself, not the active/disabled state (that comes at virtually no cost).
ex:
runtime_assert( { i:None for i in range( 10000000 ) } )
By using the syntax you describe ('boolean and not expr'), you loose all the
benefit of the Python grammar:
- self-contained
Could you please explain what you mean?
- able to catch semantic/syntax bugs
ex:
f=1
runtime_assert( f==1 )
runtime_assert( f=1 )
File "<stdin>", line 1
runtime_assert( f=1 )
^
SyntaxError: invalid syntax
Until inline assignment expression is implemented, this is an error too:
>>> if debug and not f=1:
File "<stdin>", line 1
if debug and not f=1:
^
SyntaxError: invalid syntax
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/