Live data from Hacker News

Mypy - An experimental Python variant with dynamic and static typing

mypy-lang.org

41–42 of 42 posts

Re: Mypy - An experimental Python variant with dynamic and static typing

#41
post #36

Earlier quoted context omitted.

If 99% of your codebase uses one thread, then no, a 2x slow down is not acceptable, even if you can overcome it by using more cores. Remember, the ideas was not to have CPython and CPython-without-GIL, it was to have one unified GIL-less CPython. For that, a 2x performance drop would not be acceptable for most code.

But 2x was just with the initial, non-optimized patch. A language like Java seems to perform quite well even with fine-grained locking, so it's possible. And I don't see why performance is suddenly used as a deal breaker for a language primarily used for scripting and other non-CPU-bound purposes. I speculate that the performance issue wasn't really the most important reason for rejecting the patch, but more so not w…

The difference is that Java's memory model was designed from the ground up to work with multiple threads. Python's semantics are that only 1 thread is running at any point in time. Keeping that illusion while running multiple threads in parallel is what causes the huge overhead. The alternative is to do away with CPython semantics, but that would break a ton of existing code.

Re: Mypy - An experimental Python variant with dynamic and static typing

#42

why doesn't this use the python standard for adding type information? it should be: def foo(n: int): not def foo(int n): then it would be valid python 3 code (and would also work with pytyp (disclaimer: mine)). http://docs.python.org/py3k/reference/compound_stmts.html#fu... http://www.python.org/dev/peps/pep-3107/ http://www.acooke.org/pytyp/

Mypy needs some extra syntax not provided by standard Python annotations (e.g. local variable annotations, casts), so it makes sense to have the syntax related to static typing clearly different from Python to avoid confusion. C-style annotation syntax also has the benefit of being familiar to a very large programmer population. There will also be a converter from mypy syntax to Python syntax.

just seen this reply; thanks. i encourage you to think again, though. one reason is that you would be more likely to influence the future evolution of python itself if you worked more within the system...
Post reply on HN