Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #73787

Re: unorderable error: less ok, equal ok, less-or-equal gives unorderable error!

From Peter Otten <__peter__@web.de>
Subject Re: unorderable error: less ok, equal ok, less-or-equal gives unorderable error!
Date 2014-07-01 14:43 +0200
Organization None
References <cae1276e-4463-4696-aa6b-f9e64399926b@googlegroups.com> <lose42$4v1$1@ger.gmane.org> <53B1C013.3070901@stoneleaf.us>
Newsgroups comp.lang.python
Message-ID <mailman.11366.1404218708.18130.python-list@python.org> (permalink)

Show all headers | View raw


Ethan Furman wrote:

> On 06/30/2014 12:34 PM, Peter Otten wrote:
>> RainyDay wrote:
>>>
>>>      def __eq__(self, other):
>>>          return self._loc == getattr(other, "_loc", None)
>>
>> Note that None is not a good default when _loc is expected to be a tuple:
> 
> In this case None is not being returned, but will be comparid with
> self._loc, so RainyDay is good there.

RainyDay wrote:

> I'm only using None in equality comparison, it's never a default value of
> _loc itself, so this should be ok because it'll compare to all other
> object types and correctly say they're unequal.

Yes, sorry. I read what I expected rather than what was there.

Back to comp.lang.python | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

unorderable error: less ok, equal ok, less-or-equal gives unorderable error! RainyDay <andrei.avk@gmail.com> - 2014-06-30 12:12 -0700
  Re: unorderable error: less ok, equal ok, less-or-equal gives unorderable error! Peter Otten <__peter__@web.de> - 2014-06-30 21:34 +0200
    Re: unorderable error: less ok, equal ok, less-or-equal gives unorderable error! RainyDay <andrei.avk@gmail.com> - 2014-06-30 13:29 -0700
  Re: unorderable error: less ok, equal ok, less-or-equal gives unorderable error! Ethan Furman <ethan@stoneleaf.us> - 2014-06-30 12:52 -0700
  Re: unorderable error: less ok, equal ok, less-or-equal gives unorderable error! Peter Otten <__peter__@web.de> - 2014-07-01 14:43 +0200

csiph-web