PEP 0484 – Type Hints is accepted
python.org
PEP 0484 – Type Hints is accepted
1–10 of 75 posts
Re: PEP 0484 – Type Hints is accepted
#2Re: PEP 0484 – Type Hints is accepted
#3Re: PEP 0484 – Type Hints is accepted
#4This seems exciting. I'm not familiar with the availability of new Python features. When can I use this in my day to day Python?
Re: PEP 0484 – Type Hints is accepted
#5This seems exciting. I'm not familiar with the availability of new Python features. When can I use this in my day to day Python?
Re: PEP 0484 – Type Hints is accepted
#6This seems exciting. I'm not familiar with the availability of new Python features. When can I use this in my day to day Python?
And if you don't want to create your own you could use https://pypi.python.org/pypi/obiwan
Re: PEP 0484 – Type Hints is accepted
#7This seems exciting. I'm not familiar with the availability of new Python features. When can I use this in my day to day Python?
def foo(x: int) -> str: ...
have been available since 3.0, and editors like PyCharm already use them for typechecking.For new PEP 0484 features like generics, MyPy supports Python 3.2 and up, but PyCharm support seems to be work in progress: https://youtrack.jetbrains.com/issue/PY-15206
Re: PEP 0484 – Type Hints is accepted
#8Re: PEP 0484 – Type Hints is accepted
#9So now two popular dynamic languages have type hinting of a kind: Python (unenforced annotations) and PHP (declarations). Great!
Re: PEP 0484 – Type Hints is accepted
#10This allows me to write Python in a design-by-contract style with full, rich runtime type checks. My bug count has gone down dramatically, and when I do find a bug it's virtually always via a typecheck exception.