assert 0, "foo" vs. assert(0, "foo")

Thomas Guettler guettli at thomas-guettler.de
Wed Feb 23 04:57:44 EST 2005


Hi,

Python 2.3.3 (#1, Feb  5 2005, 16:22:10) [GCC 3.3.3 (SuSE Linux)] on linux2
>>> assert 0, "foo"
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
AssertionError: foo
>>> assert(0, "foo")
>>> 

If you use parenthesis for the assert statement, it never
raises an exception.

Up to now I raised strings, but since this is deprecated,
I switched to use the second argument for the assert
statement.

Is it possible to change future python versions, that
assert accept parenthesis?

 Thomas

-- 
Thomas Güttler, http://www.thomas-guettler.de/





More information about the Python-list mailing list