[Python-ideas] Adding collections.abc.Ordered

Guido van Rossum guido at python.org
Sat Dec 26 21:20:50 EST 2015


On Sat, Dec 26, 2015 at 5:21 PM, Ben Finney <ben+python at benfinney.id.au>
wrote:

> Guido van Rossum <guido at python.org> writes:
>
> > On Sat, Dec 26, 2015 at 4:33 PM, Ben Finney <ben+python at benfinney.id.au>
> > wrote:
> >
> > > Why recommend ‘None’, though? We now have the ‘NotImplemented’
> > > object; why not set the attribute of the class as ‘foo =
> > > NotImplemented’?
> >
> > Too late by many language releases, and not worth fixing.
>
> Yes, to be clear I'm not suggesting a change of ‘__hash__ = None’.
>
> I am talking of new code, like the changes being discussed in this
> thread: since we have ‘NotImplemented’ now, we can more explicitly
> indicate not-implemented attributes with ‘foo = NotImplemented’.
>
> > Either way it's an arbitrary token that you would have to check for
> > specially and whose meaning you'd have to look up. Also,
> > NotImplemented has very special semantics (its main use is for
> > *binary* operators to indicate "not overloaded on this argument, try
> > the other") -- this has nothing to do with that.
>
> Okay, that's clear. Semantics can change over time, though, and I think
> ‘NotImplemented’ much more clearly indicates the desired semantics than
> ‘None’, and is not ambiguous with existing uses of ‘foo = None’ on a
> class.
>
> So I advocate a class-level ‘foo = NotImplemented’ as an obvious way to
> indicate an expected method is not implemented on this class.
>
> Thanks for discussing and explaining. My vote counts for whatever it
> counts for, and I'll let these arguments stand or fall as I've presented
> them.


Thanks. I'm not convinced -- I think you're trying too hard to invent a
special protocol for a pretty obscure corner case.

-- 
--Guido van Rossum (python.org/~guido)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20151226/2fb8f406/attachment-0001.html>


More information about the Python-ideas mailing list