3 ms·
Not a definitive answer to the problem but mypy supports a limited sets of common "interfaces", for instance dict-like or list-like. http://mypy.readthedocs.io
by nicolaslem 10y ago
Not a definitive answer to the problem but mypy supports a limited sets of common "interfaces", for instance dict-like or list-like.
http://mypy.readthedocs.io/en/latest/cheat_sheet_py3.html#standard-duck-types http://mypy.readthedocs.io/en/latest/cheat_sheet_py3.html#st...
- raverbashing 10y agoAh, that makes things better
- throwaway_374 10y agoThat's right, mirroring the built in (3.x) abc collections heirarchy. Which then allows you to do interesting things like delegation based polymorphism by registering with the appropriate metaclass so - just to come back to your parent's point - interrogating the type reveals it to be list-like or dict-like.