On Aug 20, 6:13 am, genxtech <jrmy.l...@gmail.com> 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 -- http://mail.python.org/mailman/listinfo/python-list