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!" _______________________________________________ code-quality mailing list code-quality@python.org https://mail.python.org/mailman/listinfo/code-quality