[Python-ideas] Optional Static Typing -- the Python Way

Antoine Pitrou antoine at python.org
Wed Aug 20 23:57:02 CEST 2014


Le 19/08/2014 20:12, Guido van Rossum a écrit :
>     Hmm, I've been saying this already, but my intuition is that it's a
>     bad idea to conflate *type descriptions* (what this proposal is
>     about) and actual *runtime types* (what ABCs are).
>
>
> But are they? I think the registration mechanism makes it clear that
> they aren't (necessarily) runtime types -- by linking a concrete type
> with an ABC through registration you are pretty clearly stating that the
> ABC *describes* (an aspect of) the concrete class without automatically
> adding any behavior from the ABC to it.

Hmm... well, they are usable at runtime (if only for isinstance calls 
:-)). I admit my wording was a bit vague here. But our type descriptions 
should be able to express more information than ABCs currently do. For 
example, I don't how you'd express the idea of a "mapping from str to 
int" using the current Mapping ABC, while retaining the runtime 
properties of the Mapping class.

Regards

Antoine.




More information about the Python-ideas mailing list