News for hackers. Stuff that matters.
Re:Why We Chose Typescript by ATsch on Friday June 30, 2017 @08:03PM (#14674381)
what would you say are the limitations of Python type annotations? From the pycon demos I've seen it seems pretty functional and complete.
Re:Why We Chose Typescript by deathanatos on Friday June 30, 2017 @08:46PM (#14674574)
* pylint / pep8 doesn't parse comment-based annotations, and thus flags imports that are in use as "unused"

* numbers.Real / Union[float,int] do not work correctly; I basically can't figure a way to annotate a function that takes an int/float/decimal/etc.

(mypy doesn't think "int" is a valid "Real", and it doesn't think you can add two Union[float,int] objects.)

(mypy has nonetheless been very helpful, and overall I would recommend it.)

Re:Why We Chose Typescript by yorwba on Friday June 30, 2017 @10:52PM (#14675084)
> I basically can't figure a way to annotate a function that takes an int/float/decimal/etc.

It seems like you should be able to just annotate it with float?

... when an argument is annotated as having type float , an argument of type int is acceptable ...

https://www.python.org/dev/peps/pep-0484/#the-numeric-tower

Re:Why We Chose Typescript by deathanatos on Friday June 30, 2017 @11:46PM (#14675260)
Hmm. I wasn't aware of that; still, it seems to not work for Decimal objects.
Re:Why We Chose Typescript by slaymaker1907 on Friday June 30, 2017 @09:30PM (#14674765)
You don't need comment based annotations since there are real annotations since python 3.5
Re:Why We Chose Typescript by make3 on Saturday July 01, 2017 @01:59PM (#14678120)
I can't tell if you're neglecting the fact that most production Python is Python 2 on purpose or not
Re:Why We Chose Typescript by deathanatos on Friday June 30, 2017 @11:43PM (#14675251)
While true, my codebase regrettably needs to run in Python 2.7.