spliting on ":"
cyril.bazin at info.unicaen.fr
Mon Mar 6 18:34:46 CET 2006
On 3/6/06, Bryan Olson <fakeaddress at nowhere.org> wrote:
> Peter Hansen wrote:
> > The archives could tell you more, but basically on is usually interested
> > in *identity* with a singleton object (None), not in whether the object
> > on is examining happens to compare equal. A custom object could be
> > designed to compare equal to None in certain cases, even though it *is
> > not* None, leading to the "== None" approach being defective code.
> But if a custom class allows instances to compare as equal to None,
> we might reasonably expect the programmers had a reason. There's not
> much anyone can do with None besides passing it around and comparing
> it by value or identity. Insisting on 'is' rather than '==' will break
> whatever polymorphism such a custom object was trying to achieve.
I agree. None is an object! If you want to compare an object to another
why not using "=="?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-list