Newbie Question regarding __init__()

Dave Angel davea at ieee.org
Tue Aug 4 05:00:13 CEST 2009


Simon wrote:
> On Aug 2, 5:51 am, Dave Angel <da... at ieee.org> wrote:
>   
>> <snip>
>> I don't understand your comparison to Foxpro.  read on.
>>
>> As your code was last posted, you don't need a return value from
>> init_Exec()  Every function that doesn't have an explicit return will
>> return None.  And None is interpreted as False in an "and" expression.  
>> If you had an "if" around the whole thing, then you'd care.
>>
>> DaveA
>>     
>
> All I meant by the FoxPro comment was the idea of using the equal sign
> without a variable to throw away the result.  Also in FoxPro there is
> no such thing as automatically returning None.  If there is no
> explicit return then True is returned.
>
> Thanks I did not know that None is interpreted as False.
>
> Simon
>
>
>   
To throw away the result of an expression in Python is even easier.  
Just don't use it.
       func1() and func2()
is a valid expression whose result is not used.  And func2()'s result is 
therefore irrelevant.  But shortcircuiting means that func2() is only 
called if func1() returned False (or something equivalent to it, like 0 
or an empty list)





More information about the Python-list mailing list