Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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#st...



That'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.


Ah, that makes things better




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: