Am I stupid or is 'assert' broken in Python 2.5??

2006-12-06 Thread antred
I've noticed something odd in Python 2.5, namely that the 2 argument version of 'assert' is broken. Or at least it seems that way to me. Run the following code in your Python interpreter: myString = None assert( myString, 'The string is either empty or set to the None type!' ) assert( myString

Re: Am I stupid or is 'assert' broken in Python 2.5??

2006-12-06 Thread Jean-Paul Calderone
On 6 Dec 2006 06:34:49 -0800, antred [EMAIL PROTECTED] wrote: I've noticed something odd in Python 2.5, namely that the 2 argument version of 'assert' is broken. Or at least it seems that way to me. Run the following code in your Python interpreter: myString = None assert( myString, 'The string

Re: Am I stupid or is 'assert' broken in Python 2.5??

2006-12-06 Thread antred
Never mind, I'm a schmuck!! =0 It should have been assert myString, 'String empty or None!' Sorry, ignore me. =\ -- http://mail.python.org/mailman/listinfo/python-list

Re: Am I stupid or is 'assert' broken in Python 2.5??

2006-12-06 Thread Christophe
antred a écrit : I've noticed something odd in Python 2.5, namely that the 2 argument version of 'assert' is broken. Or at least it seems that way to me. Run the following code in your Python interpreter: myString = None assert( myString, 'The string is either empty or set to the None

Re: Am I stupid or is 'assert' broken in Python 2.5??

2006-12-06 Thread Marc 'BlackJack' Rintsch
In [EMAIL PROTECTED], antred wrote: Run the following code in your Python interpreter: myString = None assert( myString, 'The string is either empty or set to the None type!' ) assert( myString ) You'll notice that the first assert doesn't do anything, whereas the second assert

Re: Am I stupid or is 'assert' broken in Python 2.5??

2006-12-06 Thread Peter Otten
antred wrote: I've noticed something odd in Python 2.5, namely that the 2 argument version of 'assert' is broken. Or at least it seems that way to me. Run the following code in your Python interpreter: myString = None assert( myString, 'The string is either empty or set to the None

Re: Am I stupid or is 'assert' broken in Python 2.5??

2006-12-06 Thread Laurent Pointal
antred a écrit : I've noticed something odd in Python 2.5, namely that the 2 argument version of 'assert' is broken. Or at least it seems that way to me. Run the following code in your Python interpreter: myString = None assert( myString, 'The string is either empty or set to the None

Re: Am I stupid or is 'assert' broken in Python 2.5??

2006-12-06 Thread antred
Yeah, it hit me seconds after I had posted my message. =0 Why didn't I think of it during the 30 minutes I spent banging my head against the keyboard going nuts over this 'bug' ... -- http://mail.python.org/mailman/listinfo/python-list

Re: Am I stupid or is 'assert' broken in Python 2.5??

2006-12-06 Thread [EMAIL PROTECTED]
The reason why it won't raise the AssertionError is because the condition in the assert statement is a non-empty tuple, and its boolean value would be True, not False, which is required to raise an assertion error. antred wrote: Yeah, it hit me seconds after I had posted my message. =0 Why

Re: Am I stupid or is 'assert' broken in Python 2.5??

2006-12-06 Thread Terry Reedy
antred [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Yeah, it hit me seconds after I had posted my message. =0 Why didn't I think of it during the 30 minutes I spent banging my head against the keyboard going nuts over this 'bug' ... Because communication brings consciousness ;-)

Re: Am I stupid or is 'assert' broken in Python 2.5??

2006-12-06 Thread Gabriel Genellina
At Wednesday 6/12/2006 11:46, antred wrote: Yeah, it hit me seconds after I had posted my message. =0 Why didn't I think of it during the 30 minutes I spent banging my head against the keyboard going nuts over this 'bug' ... The same reason you can sometimes find what's wrong just by

Re: Am I stupid or is 'assert' broken in Python 2.5??

2006-12-06 Thread Neil Cerutti
On 2006-12-07, Gabriel Genellina [EMAIL PROTECTED] wrote: Yeah, it hit me seconds after I had posted my message. =0 Why didn't I think of it during the 30 minutes I spent banging my head against the keyboard going nuts over this 'bug' ... The same reason you can sometimes find what's wrong just

Re: Am I stupid or is 'assert' broken in Python 2.5??

2006-12-06 Thread Ben Finney
Neil Cerutti [EMAIL PROTECTED] writes: On 2006-12-07, Gabriel Genellina [EMAIL PROTECTED] wrote: The same reason you can sometimes find what's wrong just by explaining the symptoms to another guy... Having to put things sorted and simple to understand by another, just makes you think