[issue30518] Import type aliases from another module
Ivan Levkivskyi
report at bugs.python.org
Fri Jun 2 13:55:08 EDT 2017
Ivan Levkivskyi added the comment:
> Block = [int, Tuple[int]]
> Blocks = List[Block]
These are both invalid type aliases (I have no idea why PyCharm does not flag them, you could report this at PyCharm issue tracker). I am not sure what exactly you want. If you want a list of either integers or tuples of integers, then you should write for example:
Block = Union[int, Tuple[int, ...]]
Blocks = List[Block]
Concerning import, this is definitely not a problem with aliases. What I have noticed is that you write "I have a 'base' module ..." and then "from base_module import ...", if you have a module named base.py, then you should write:
from base import Blocks, Tags
Or maybe you just have an import cycle...
----------
nosy: +levkivskyi
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue30518>
_______________________________________
More information about the Python-bugs-list
mailing list