spliting on ":"

Cyril Bazin cyril.bazin at info.unicaen.fr
Mon Mar 6 12:34:46 EST 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
object
why not using "=="?

Cyril
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20060306/8146d7f4/attachment.html>


More information about the Python-list mailing list