Reference
Roy Smith
roy at panix.com
Mon Mar 3 18:02:04 EST 2014
In article <mailman.7669.1393885090.18130.python-list at python.org>,
Ben Finney <ben+python at benfinney.id.au> wrote:
> That's right. Python provides this singleton and then recommends you
> compare with âisâ, precisely to protect against pathological cases like
> a âreturn True when compared for equality with Noneâ data type.
Going off on a tangent, I've often wished Python provided more kinds of
None-ness. I'll often write:
def f(arg=None):
whatever
where it would be nice to differentiate between "this was called with no
arguments" and "this was called with an argument of None". Sure, I can
work around that with things like **kwargs, and then test
"args" in kwargs
vs.
kwargs["args"] is None
but that always feels clumsy. It also makes the function declaration
less sell-describing. "Hmmm, let's see what help() says. Oh, gee, I
can pass it some stuff".
More information about the Python-list
mailing list