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

Carl Banks invalidemail at aerojockey.com
Wed Feb 23 14:53:14 EST 2005


Thomas Guettler wrote:
> Is it possible to change future python versions, that
> assert accept parenthesis?


It's possible, but extremely unlikely that it will ever happen.  assert
is not a function, but a statement (like print).  Statements don't use
parentheses; when you use parentheses, it considers that a tuple.

For example, if you try this with print:

print ("hello","world")

you see that in prints out a tuple value, rather than treating "hello"
and "world" as arguments.  Same thing with assert.


-- 
CARL BANKS




More information about the Python-list mailing list