Live data from Hacker News

PEP 0484 – Type Hints is accepted

python.org

21–30 of 75 posts

Re: PEP 0484 – Type Hints is accepted

#21
post #18
post #14

Earlier quoted context omitted.

Would you like to reconsider your tone?

No, but let me clarify. Bolting on a form of type checking to a weakly typed language seems orthogonal to the nature of a language like Python. If you find yourself saying "I wish I had a type system in this code base, its getting pretty big and a compiler that does type checking at compile time sure would make my life easier" maybe you should think about using a more appropriate tool. I use Python a lot and it has i…

Though I agree with your sentiment, I must mention that there is nothing "weak" about Python's type system.

You likely meant "dynamic", not "weak". See here:

wiki.python.org/moin/Why%20is%20Python%20a%20dynamic%20language%20and%20also%20a%20strongly%20typed%20language

Re: PEP 0484 – Type Hints is accepted

#22
So python becomes nim now?

I wish they kept separate ways. Python for simple and powerful hobbyist programs and nim for the enterprise.

If we have two languages doing the same thing, we will abandon one group of enthusiasts. Then another language will come to fill the gap.

Re: PEP 0484 – Type Hints is accepted

#23

So python becomes nim now? I wish they kept separate ways. Python for simple and powerful hobbyist programs and nim for the enterprise. If we have two languages doing the same thing, we will abandon one group of enthusiasts. Then another language will come to fill the gap.

I see your point in hobbyist vs. enterprise, but Python is already used in multiple big corporations and I don't think I have seen any result of it being a problem. If anything, the language gets more and more attention due to its spreading popularity on all levels. Isn't that just for the good of the language?

As I mentioned it is already used in several big corporations. From your point of view - is it a problem right now?

Re: PEP 0484 – Type Hints is accepted

#24

So python becomes nim now? I wish they kept separate ways. Python for simple and powerful hobbyist programs and nim for the enterprise. If we have two languages doing the same thing, we will abandon one group of enthusiasts. Then another language will come to fill the gap.

Pretty sure Python is very "enterprise"[1] worthy.

[1] - https://www.paypal-engineering.com/2014/12/10/10-myths-of-en...

Re: PEP 0484 – Type Hints is accepted

#25

One of the reasons why I use Python 3.x exclusively is for the new function annotations, which allow use of this: https://github.com/prechelt/typecheck-decorator This 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.

This might sound odd, but lately I haven't noticed any bugs I've introduced to production that were type errors. Inevitably my code will produce results of the right type, but have a logical error that makes either the answer flat out wrong or more or less inaccurate based on our cloud requirements.

Ah but type annotations allow tools like QuickCheck to exist, so you can automatically catch those logic errors too!

Re: PEP 0484 – Type Hints is accepted

#26
post #9

Earlier quoted context omitted.

I encourage all use of the type system to ensure program correctness, but once you've had Hindley-Milner inference, it's hard to muddle along with something like this.

It really is. Since using Haskell, the type systems in the mainstream languages I've used have seemed sorely lacking.

Having used Haskell a lot, I still feel pretty fine about C++ or C# type systems.

It's Java's that drives me absolutely insane. Type erasure makes me want to pull my hair out.

Re: PEP 0484 – Type Hints is accepted

#27

Earlier quoted context omitted.

It really is. Since using Haskell, the type systems in the mainstream languages I've used have seemed sorely lacking.

Having used Haskell a lot, I still feel pretty fine about C++ or C# type systems. It's Java's that drives me absolutely insane. Type erasure makes me want to pull my hair out.

I agree that Java is painful to use, but why is type erasure the annoyance that you need to single out? Haskell does type erasure as well.

Re: PEP 0484 – Type Hints is accepted

#28

So python becomes nim now? I wish they kept separate ways. Python for simple and powerful hobbyist programs and nim for the enterprise. If we have two languages doing the same thing, we will abandon one group of enthusiasts. Then another language will come to fill the gap.

Pretty sure Python is very "enterprise"[1] worthy. [1] - https://www.paypal-engineering.com/2014/12/10/10-myths-of-en...

I remain on the fence myself, but that article mostly argues that it is useable and used in the enterprise, not that it's worthy of use at that project size and scale. I think that article, rather than being a strong technical piece, is a pretty good example of:

http://en.wikipedia.org/wiki/Argumentum_ad_populum

Also, it doesn't take much google-fu to find a counterargument from someone apparently reputable:

http://www.quora.com/Why-does-Google-prefer-the-Java-stack-f...

Re: PEP 0484 – Type Hints is accepted

#29

One of the reasons why I use Python 3.x exclusively is for the new function annotations, which allow use of this: https://github.com/prechelt/typecheck-decorator This 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.

I can see this being very useful. Runtime type checking, a contract for code to follow; all should help out with better code quality.

Re: PEP 0484 – Type Hints is accepted

#30

So python becomes nim now? I wish they kept separate ways. Python for simple and powerful hobbyist programs and nim for the enterprise. If we have two languages doing the same thing, we will abandon one group of enthusiasts. Then another language will come to fill the gap.

Since when was Nim more for the enterprise than Python?
Post reply on HN