[Python-ideas] Optional static typing -- the crossroads

Greg Ewing greg.ewing at canterbury.ac.nz
Mon Aug 18 08:33:11 CEST 2014


Andrew Barnert wrote:

> typing.Iterable and typing.Hashable are both typing.Protocols, so
> HashableIterable is also a typing.Protocol, so, if I understand Protocol
> correctly, isinstance will return True iff every method and attribute in
> HashableIterable (that is, every method and attribute in Iterable, plus every
> method and attribute in Hashable) is implemented by the type.

Urg. In that case, how do you spell a type that *is*
a concrete class that implements Hashable and Iterable,
rather than a new protocol?

There's too much magic going on here for my liking.

-- 
Greg


More information about the Python-ideas mailing list