[Python-3000] Generic function PEP won't make it in time
Guido van Rossum
guido at python.org
Thu Apr 26 05:49:15 CEST 2007
On 4/25/07, Greg Ewing <greg.ewing at canterbury.ac.nz> wrote:
> From the PEP, it seems there are two purposes for
> these proposed ABCs:
>
> 1) To document what is meant when we say that something
> is a "sequence", "mapping", etc.
>
> This could be done simply by writing documentation. There
> is no need for anything embodied in the language.
>
> 2) To mark a class for the purposes of introspection.
>
> I thought we had generally agreed that this is an
> anti-pattern in Python.
Then how do you explain the popularity of zope.interfaces in both the
Zope and the Twisted world? While it often is an anti-pattern, it
isn't always, and I don't see why we should forever have to tell
people who need this functionality "go download this obfuscated piece
of 3rd party code."
> If I want my object to
> interoperate with someone else's code that tests for
> the presence of some ABC, then I *am* forced to use
> that ABC, even if it doesn't entirely suit my
> purposes.
No different than if you want to interoperate with someone who uses
zope.interfaces, except you won't have to use 3rd party code, so the
cost to you of conforming is many times lower.
> I'm -1 on including anything in the language, stdlib
> or docs that appears to officially sanction type
> testing as a normal style of programming.
Read PEP 3119's Rationale.
--
--Guido van Rossum (home page: http://www.python.org/~guido/)
More information about the Python-3000
mailing list