3 ms·
Can I use Python type hints in a package? I.e. is there some way to transpile code (much alike TypeScript to JavaScript), so that the code can be installed by
by stared 7y ago
Can I use Python type hints in a package?
I.e. is there some way to transpile code (much alike TypeScript to JavaScript), so that the code can be installed by lower versions of Python than 3.6?
- dveeden2 7y agoThe type hints work with older Python 3 versions. They just get ignored and mypy can use them. However the type hinting syntax for Python 2 isn't the same. For Python 2 you have to use comments. I don't think there is a way to convert between Python 2 and Python 3. Maybe a good reason to say goodbye to Python 2.