[Python-ideas] Structural type checking for PEP 484
Andrew Barnert
abarnert at yahoo.com
Fri Sep 11 00:27:05 CEST 2015
On Sep 10, 2015, at 11:57, Matthias Kramm via Python-ideas <python-ideas at python.org> wrote:
>
>> On Wednesday, September 9, 2015 at 1:19:12 PM UTC-7, Guido van Rossum wrote:
>> Jukka wrote up a proposal for structural subtyping. It's pretty good. Please discuss.
>>
>> https://github.com/ambv/typehinting/issues/11#issuecomment-138133867
>
> I like this proposal; given Python's flat nominal type hierarchy, it will be useful to have a parallel subtyping mechanism to give things finer granularity without having to resort to ABCs.
I don't understand this, given that resorting to protocols is basically the same thing as resorting to ABCs.
Clearly there's some perceiving difficulty or complexity of ABCs within the Python community that makes people not realize how simple and useful they are. But I don't see how adding something that's nearly equivalent but different and maintaining the two in parallel is a good solution to that problem.
There are some cases where the fact that ABCs rely on a metaclass makes them problematic where Protocols aren't (basically, where you need another metaclass), but I doubt that's the case you're worried about.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20150910/cb6f54b0/attachment.html>
More information about the Python-ideas
mailing list