Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Type annotations #75

Open
lewisacidic opened this issue Sep 12, 2016 · 4 comments
Open

Type annotations #75

lewisacidic opened this issue Sep 12, 2016 · 4 comments

Comments

@lewisacidic
Copy link
Owner

Currently, we use the 'legacy' google style docstrings to specify type annotations. Python 3.5 supports type annotations, but Python 2 doesn't. Too many cheminformaticians still use Python 2 to drop support yet (although I would like to asap!).

We could create .pyi files, which state the type annotations in a separate file, as a stop gap until we can drop Python 2 support, or just keep using the 'legacy' versions.

Personally, I think this keeping the legacy style would waste the least amount of time, although I am very keen to bring in type annotations.

@hainm
Copy link

hainm commented Sep 19, 2016

you indeed can use type notation in py2.

https://github.com/python/typing/tree/master/python2

@lewisacidic
Copy link
Owner Author

Thanks for the input. I think I was meaning syntax supported annotations such as:

def sum(a: int, b: int) -> int:
    return a + b

To my knowledge this is only supported in 3.5, and the typings python 2 module adds the support to the language implementation, but not the syntax. The 3.5 system is definitely the nicest way to do type annotations, if Python 2 didn't exist!

@hainm
Copy link

hainm commented Sep 19, 2016

I think you need to install typing package by yourself in py2.

https://pypi.python.org/pypi/typing/3.5.2

Hai

On Sep 19, 2016, at 10:32 AM, Rich P. I. Lewis notifications@github.com wrote:

Thanks for the input. I think I was meaning syntax supported annotations such as:

def sum(a: int, b: int) -> int:
return a + b
To my knowledge this is only supported in 3.5, and the typings python 2 module adds the support to the language implementation, but not the syntax. The 3.5 system is definitely the nicest way to do type annotations, if Python 2 didn't exist!


You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.

@mwojcikowski
Copy link

I understand it's fully backported, and uses the same name space.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants