[Python-3000] Generic function PEP won't make it in time

Guido van Rossum guido at python.org
Wed Apr 25 22:14:17 CEST 2007


On 4/25/07, Paul Moore <p.f.moore at gmail.com> wrote:
> On 25/04/07, Emin.shopper Martinian.shopper <emin.shopper at gmail.com> wrote:
> > I disagree. I think that B&D-ish enforcement of ABCs is the most important
> > feature of an ABC (with the option of being able to turn off enforcement on
> > a per-class basis).
>
> OK. We can agree to disagree. My point was that as far as I am aware,
> Guido's current position on ABCs is that they are, and will remain,
> optional - people like myself (and Greg, from the sound of it) who
> don't want to derive from ABCs will not be penalised by being excluded
> from anything in the Python core or the stdlib.
>
> Example - I recall Guido saying explicitly that there will be no
> requirement for objects assigned to sys.stdout to derive from any of
> the IO ABCs.

Yes, that's actually in the PEP.

But while I don't like Emin Shopper's argument (it sounds like too
much like the classic static type checking argument), I am not about
to remove the @abstractmethod decorator or its semantics (that it must
be overridden in order to be allowed to instantiate the class). You
don't need to use it (and I recommend thinking twice before you use
it).

But it makes sense in some cases to insist that someone who goes
through the trouble of inheriting from an ABC gets an error if they
forget to implement one of the methods that are deemed 'essential' to
that ABC.

Concerning the use case where you'd like to claim to implement an ABC
but happen to know that a particular method will never be called, I
suspect that this is the exception of ABC usage rather than the common
case, so I'd rather cater to the common case. ESNPS.

-- 
--Guido van Rossum (home page: http://www.python.org/~guido/)


More information about the Python-3000 mailing list