11 Nov
2013
11 Nov
'13
6:29 p.m.
Vladimir,
2. I don't have much to comment on how the types should be specified, but you should take into account that python is duck-typed language. Sometimes the type is "anything that implements .read() and .write() methods", or "anything that follows `__contains__` protocol».
Yes, duck typing is one of the issues a type system for Python has to address. Possible solutions: * Add structural typing (anything with a particular set of attributes will do) * Use abstract base classes like in 'collections' and 'numbers' stdlib modules * Don't annotate duck-typed values -- Andrey Vlasovskikh Senior Software Developer JetBrains http://www.jetbrains.com/ "Develop with pleasure!"