Skip to content

"from typing import Type" (works in Debian, not working under Arch) #1838

@ttsiodras

Description

@ttsiodras

I installed typing via pip3 in both my Debian and Arch environments, and see this:

Under Debian:

$ pip3 freeze | grep typing
typing==3.5.2.2

$ python3
Python 3.4.2 (default, Oct  8 2014, 13:14:40) 
[GCC 4.9.1] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from typing import Type
>>> 

Under Arch:

$ pip3 freeze | grep typing
typing==3.5.2.2

$ python3
Python 3.5.1 (default, Mar  3 2016, 09:29:07) 
[GCC 5.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from typing import Type
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: cannot import name 'Type'
>>> 

Have I messed up or is there some difference due to 3.4 -> 3.5?

P.S. In case there's a way around it - I use Type, because I have annotated code like this:

U = TypeVar('U', int, float)

def GetRange(newModule: Module, lineNo: int, nodeWithMinAndMax: Element, valueType: Type[U]) -> Tuple[U, U]:
    ...
    rangel = valueType(mmin)
    rangeh = valueType(mmax)
    return (rangel, rangeh)

...so I can create the appropriate type at runtime in my AST.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions