[Python-3000] Breakthrough in thinking about ABCs (PEPs 3119 and 3141)
Phillip J. Eby
pje at telecommunity.com
Tue May 1 03:08:04 CEST 2007
At 05:19 PM 4/30/2007 -0700, Guido van Rossum wrote:
>Collin will continue to develop his Roles PEP. This may or may not end
>up providing a viable alternative to ABCs; in either case it will be
>refreshing to compare and contrast the two proposals.
These should also be interesting to compare with the "interfaces" part of
PEP 3124, although they need not compete. (The module proposed in 3124
should be able to use ABCs or Roles as easily as it does its own Interfaces.)
>Personally, I still think that the most uniform way of spelling this
>is overloading isinstance and issubclass; that has the highest
>likelihood of standardizing the spelling for such inquiries.
A big +1 here. This is no different than e.g. operator.mul() being able to
do different things depending on the second argument.
>(is this the typeclass thing in Haskell?).
Yeah; you'd say that in the typeclass "TotallyOrdered a", that "<" is a
2-argument function taking two "a"'s and returning a boolean. But that's
way more parameterized than we can do in Python any time soon. I don't
even go that far for PEP 3124, although in principle you could use its
extension API to do something like that. Not something I want to even try
thinking about in detail right now, though.
More information about the Python-3000