From: D-Man <ds...@ri...> - 2001-03-29 20:42:21
|
On Thu, Mar 29, 2001 at 06:01:55PM +0000, Finn Bock wrote: | [assert/raise on tuples or on exprs] | | I can't quite find head or tail in this discussion, but I think that the | conclusions are wrong. I think you got it all ;-). | The "assert" statement allow for one or for two expresion as arguments. | You are allow to make that single expresion a 2-tuple, but I bet that it | doesn't do what you wanted it to do: | ... | >>> assert 0, "message" | Traceback (innermost last): | File "<console>", line 1, in ? | AssertionError: message | >>> assert (0, "message") | >>> | | Notice that the last assert didn't throw an AssertionError and it never | will. Hmm, oops. Thanks! | I'll also like to set straight that there are IMO *not* any conflict in | the grammar or language def about the optional comma in the assert | statement and the tuple creating comma in the atom production. Given that last example, there no longer seems to be a conflict. I was mistakenly thinking that assert ( expr , "message" ) was identical to assert expr , "message" which led to the confusion with the documentation. -D |