|
Mark Dickinson |
at Aug 20, 2010 at 7:27 am
|
⇧ |
| |
On Aug 20, 6:13?am, genxtech wrote:
This is more of a curiosity question then anything else... ?I was just
wondering why in version 3 of python assertions weren't converted to
use parenthesis, since print was.
I am just asking because it seems the following line of code would
seem more readable as a function:
? ?assert 2 + 2 == 5, "Only for very large values of 2."
Well, part of the idea of asserts is that when you're running with
optimizations turned on (python -O), asserts should be disabled. But
if assert were a normal function then in
assert(expensive_check)
the argument expensive_check would be evaluated both with 'python' and
with 'python -O'.
--
Mark