20 Apr
2021
20 Apr
'21
5:51 p.m.
On Tue, Apr 20, 2021 at 10:03 AM Mark Shannon <mark@hotpy.org> wrote:
... PEP 544 supports structural typing, but to declare a structural type you must inherit from Protocol. That smells a lot like nominal typing to me.
Note that to implement a protocol you do not have to inherit from anything. You create a structural type that subclasses Protocol, but then any object that satisfies that protocol can be passed where that type is expected, without having to inherit anything, so I would argue that this really is structural typing. -- - eric casteleijn (he/him)