Forgetting "()" when calling methods
Alex Martelli
aleax at aleax.it
Sun Apr 27 04:31:18 EDT 2003
Erik Max Francis wrote:
> Alex Martelli wrote:
>
>> I think "if f is None:" and even more "if callable(f):" are
>> better ways to express this test -- explicit is better than
>> implicit.
>
> I agree wholeheartedly. I was just giving an real-world example of use
> where the "Booleanness" of a function-or-maybe-not-a-function would be
> useful.
Yes, I understood that -- sorry if I wasn't explicit(:-) enough
in expressing my understanding.
> I personally explicitly do "x is None" tests for anything when I'm
> checking for Noneness, this was just as an example.
More importantly, it MAY be a widespread usage pattern (perhaps by
mistaken analogy with other "if x:" usages). If so, then breaking
it would be unconscionable. _However_ -- *warnings* can still be
optionally emitted, even though "if f:" were to be supported
forevermore -- newbies-who-forget-() might enable those warnings
and so still get some help, having their error diagnosed ASAP.
Hmmm...
Alex
More information about the Python-list
mailing list