6 ms·
Bah. If you want a statically typed language, get a statically typed language. What's a type hint for if, after that, the user can actually pass a different ty
by alanfranzoni 10y ago
Bah. If you want a statically typed language, get a statically typed language.
What's a type hint for if, after that, the user can actually pass a different type?
- RubyPinch 10y agofor documentation
- IshKebab 10y agoIDE code completion and linting, which is admittedly an area where Python sucks. But I'm inclined to agree. It's a little too to add static typing to Python. You're just going to end up with something far worse than a language that was designed with it in mind, like Ceylon or Go.
- JustSomeNobody 10y agoPython is a language where I simply don't miss code completion.
- IshKebab 10y agoWhy not? Code completion is definitely useful in Python (when it works, which is rarely). It saves time looking up documentation.
- JustSomeNobody 10y agoI find I can keep most things I currently need in my head with Python. Which is nice as some IDEs tend to offer code completion popups OVER the line I'm typing which is very annoying and breaks my thought process. Also, for _me_, not using code completion helps me think more about what I'm actually doing and not code so much on autopilot. I actually write much better, succinct code without completion. YMMV
- IshKebab 10y agoSounds very like an excuse to me.
- junke 10y agoA type checker for Python can say: "pass", "reject" or "I don't know". Statically typed languages (1) introduce limitations so that type checking is decidable (no incertitude), or (2) or treat "don't know" as "reject", because the runtime has practically no knowledge of type. This is not the case in Python, so you don't have to check everything. That does not mean you shouldn't check anything. So there are still benefits in Python to have type in order to "reject" code that is undoubtedly going to produce type errors at runtime (or maybe to optimize things). In case of uncertainty, you know the runtime is going to catch errors anyway (including type errors).
- KayEss 10y agoFor structurally typed languages you really want something like C++'s concepts so you can talk about `Iterable[str]` rather than forcing it to `List[str]`. Is this possible with Python's type annotations?
- junke 10y agoI don't know exactly for Python. I would expect mixin class to be used for this. Also, maybe Python will allow you to define union types: e.g. X is either a "foo", a "bar" or a "zot" (all of them duck types the same implicit interface).
- KayEss 10y agoIt's kind of hard because you really want to be able to use generator functions as well. Maybe that just can't be properly described Python. It would be shame to lose out on passing a generator because somebody has used `List[int]` inside a function that really takes an iterable.
- raverbashing 10y agoAnd that's why it's bad. Let's throw something useful (duck typing) out of the window to please the Java people I'm sincerely disgusted
- geezerjay 10y ago> Bah. If you want a statically typed language, get a statically typed language. Which statically typed scripting language would you suggest instead of Python?
- alanfranzoni 10y agoWhat do you mean by "scripting language"? That's an old terminology which is lacking a clear sense nowadays. Would you like something that you can embed? Something that has an interpreter for?
- geezerjay 10y ago> What do you mean by "scripting language"? That's an old terminology which is lacking a clear sense nowadays. https://en.wikipedia.org/wiki/Scripting_language https://en.wikipedia.org/wiki/Scripting_language > Would you like something that you can embed? Something that has an interpreter for? I asked about your personal preference regarding a statically typed alternative to Python. Can you propose one?
- tyoverby 10y agoI'm not the person that you responded to, but C# has a nice scripting API and repl.