Lennart Regebro wrote:
> On Mon, Jan 25, 2010 at 14:34, Nick Coghlan <ncogh...@gmail.com> wrote:
>> However, returning NotImplemented generally implies that A and B are
>> *different* classes
> 
> Which is exactly the case here.

It wasn't in my tests though - I used the same class on both sides of
the comparison.

>> so I think this is more of a theoretical problem
>> than a practical one.
> 
> How so? The whole point of returning NotImplemented is to give the
> other class a go. But if that other class implements this recipe, you
> get infinite recursion. It seems to me that it means that this recipe
> is broken, as it doesn't handle the other class returning
> NotImplemented.

Ah, you mean the case where both classes implement the recipe, but know
nothing about each other and hence both return NotImplemented from their
root comparison?

OK, that sounds like a plausible real world problem with the recipe, but
I'm not sure how difficult it would be to fix. For homogeneous
collection of objects with nary a NotImplemented in site, it's still a
decent recipe.

Cheers,
Nick.

-- 
Nick Coghlan   |   ncogh...@gmail.com   |   Brisbane, Australia
---------------------------------------------------------------
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to