converting a nested try/except statement into try/except/else

John Salerno johnjsal at NOSPAMgmail.com
Fri Aug 11 10:15:27 EDT 2006


Boris Borcic wrote:
> Boris Borcic wrote:
>> John Salerno wrote:
>>> In this case the method must return False, because it's a wxPython 
>>> method that needs a True or False value. If it doesn't, the program 
>>> will continue even after the error message.
>>
>> Just as it should do if the method returns True and no error message 
>> is produced if I understand you well... Are you sure ? I don't know 
>> wxPython, but this strikes me as surprisingly unpythonic behavior.
> 
> I just verified on the wxWindows demo I had somehow installed on my box, 
> that indeed returning None appears to produce the same behavior as 
> returning True, distinct from the behavior obtained by returning False. 
> Ugh...

But since None == False is false, isn't it right that returning None 
wouldn't necessarily behave like returning False?



More information about the Python-list mailing list