8 ms·
I am disappointed in Python core developers when they decided to accept static typing to Python 3. It bothers me more than the formatting PEP.
by yeukhon 10y ago
I am disappointed in Python core developers when they decided to accept static typing to Python 3. It bothers me more than the formatting PEP.
- twblalock 10y agoIt's optional. How can that possibly bother you? Don't use it if you don't like it.
- xapata 10y agoBecause I'll need to support people that use it and explain it to newbies who read it. More work to do, without much benefit (to me; I understand it has much benefit to some people).
- StavrosK 10y agoIt's only without benefit if you don't write Python. Otherwise, it's like having tests that take almost no effort to write. What's not to love about it?
- xapata 10y agoEdward Tufte might call it chart junk. It reduces the information to ink ratio. I generally get by just fine by choosing good names, so I don't need extra type checking beyond the standard duck typing.
- catdog 10y agoIt's not only optional, it does nothing by default. What was introduced into python is a standardized way to do type annotations. It consists mostly of a new standard library module and as far as i know it doesn't even introduce changes to the language as it uses comments, additional files and the rarely used function annotations. The interpreter happily ignores them anyways but external tools like mypy don't have to invent their own incompatible syntax.
- twblalock 10y agoI was more excited about them when I believed they were actually enforced. I guess they help with static analysis in IDEs, but you can still get type errors at runtime, so Python is still missing out on the main advantage of static typing.
- hendzen 10y agothere is a type checker available: http://mypy-lang.org/ http://mypy-lang.org/
- viraptor 10y ago> as far as i know it doesn't even introduce changes to the language as it uses comments That's not the case. See for example https://www.python.org/dev/peps/pep-0484/#type-definition-syntax https://www.python.org/dev/peps/pep-0484/#type-definition-sy...
- yeukhon 10y agoWhy add static typing to a language long stood for duck typing? There should really be one way to write in Python.
- coderzach 10y agoI've had great experiences with optional static typing from tools like flow[1] and mypy. I've found you can gain most of the bug catching and readability benefits of static typing, while having the power of dynamic typing when come across a truly dynamic problem.
- srean 10y agoA few things. i) its not a type checker. It cannot actually ensure type correctness. So may be a more appropriate description would be "a very smart linter". ii) Its optional iii) even when switched on it does nothing unless you are explicitly using its features iv) The "there is only one way to do things in Python" is just vapid marketing. It is not true and has never been true.
- dagw 10y ago"there is only one way to do things in Python" is just vapid marketing. It's not even that, the actual quote is "There should be one, and preferably only one, obvious way to do things". The whole "there is only one way to do it" was a joke response to Perl's "There's more than one way to do it" motto.
- antod 10y agoThe explicit version: "There should be an obvious way to do something. Ideally only one way will be obvious." The original version was too implicit. Unless you are Dutch.