Newbie Question regarding __init__()
Simon
dciphercomputing at gmail.com
Tue Aug 4 16:05:10 EDT 2009
On Aug 3, 11:00 pm, Dave Angel <da... at ieee.org> wrote:
> 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)
Thanks for telling me how Python throws away the result. Secondly my
code works perfectly now that I am properly defining my methods using
"self".
More information about the Python-list
mailing list