News for hackers. Stuff that matters.
Re:Python's Type Checking Renaissance by booleandilemma on Tuesday January 26, 2021 @12:01PM (#25918213)
I'm glad that strong typing is getting popular and it's not just for weak minds anymore.

But (for new projects anyway) what's the point of using Python with types instead of using a real typed language like Java or C#?

Re:Python's Type Checking Renaissance by duckerude on Tuesday January 26, 2021 @12:40PM (#25918799)
A use case is library code. I've had good results using type annotations internally in a library for education and research. Static typing would be overkill for most of the users of the library but it's useful for developing the library itself.

Aside from that, an advantage is that the type system is more expressive than that of Java or C#. Most common Python idioms work just the same way with or without type annotations, so you can continue to write functions that take either int or str arguments (for better or worse) and the typechecker will understand your use of isinstance and make sure everything checks out. (But there are other fully statically typed languages that are also more expressive than Java or C#.)

You can also continue to do weird metaprogramming and monkeypatching, and though the typechecker is not always able to make sense of it you can often wrap it in a safe interface so you can still get assurances for the rest of the project.

Re:Python's Type Checking Renaissance by human_error on Tuesday January 26, 2021 @10:29PM (#25923891)
Not sure if you know what you're talking about. Python has always been a strongly typed language.
Re:Python's Type Checking Renaissance by b5n on Wednesday January 27, 2021 @12:47AM (#25924763)
Surprised to see you downvoted on HN for being right. In a thread specifically regarding python typing you would think getting the basics right is kind of important.

I don't see the hype here, just use a statically typed language if it's an important consideration for the project.

Re:Python's Type Checking Renaissance by booleandilemma on Tuesday January 26, 2021 @11:40PM (#25924385)
You’re probably one of those people that says “you mean the world wide web?” when someone says the internet.
Re:Python's Type Checking Renaissance by lmm on Wednesday January 27, 2021 @05:10AM (#25926357)
No it hasn't. Python has things that it calls types, but they're not types: you can't determine the "type" of an expression from the "type" of its components.
Re:Python's Type Checking Renaissance by joshuamorton on Tuesday January 26, 2021 @01:26PM (#25919394)
What makes Java's typing more "real" than python's?

I find typed python more pleasant and expressive than similar Java, for a variety of reasons, among them, I find python's type system to be superior to Java's (and getting even better faster!)

Re:Python's Type Checking Renaissance by t-writescode on Wednesday January 27, 2021 @03:30AM (#25925681)
They're probably suggesting performance differences
Re:Python's Type Checking Renaissance by high_density on Tuesday January 26, 2021 @12:17PM (#25918461)
the point of using python? ML libraries! that's the 99% case of python-only case.

Other than that, I actually don't know... a lot of other languages now have interpreted-dev envs...

(btw, I'd rather use Kotlin than java --- it's like Java++)

Re:Python's Type Checking Renaissance by pjmlp on Wednesday January 27, 2021 @04:09AM (#25925907)
Even there, many of those libraries are written in C, Fortran and C++.

On can use any bindings to those libraries, including using modern versions of Fortran and C++ directly.

Re:Python's Type Checking Renaissance by aldanor on Wednesday January 27, 2021 @07:21AM (#25927329)
Not necessarily ML, more generally - numeric, as in NumPy/scipy/pandas, variety of optimisers, plotting and reporting tools and whatnot.
Re:Python's Type Checking Renaissance by booleandilemma on Tuesday January 26, 2021 @04:23PM (#25921229)
This is the only reply to my question that makes sense, thanks!

All of the other replies are subjective.

Re:Python's Type Checking Renaissance by jasonpeacock on Tuesday January 26, 2021 @12:20PM (#25918495)
Those are compiled languages, while Python is an interpreted language. You're comparing apples and oranges.

Interpreted languages are quick to develop/quick to learn, and with the support of typing that same "quick prototype" can easily mature into a full application without needing to be re-written in a "real" language.

Re:Python's Type Checking Renaissance by dehrmann on Tuesday January 26, 2021 @08:27PM (#25923154)
This isn't an interesting distinction for quick prototypes because the difference is basically

    python task.py
vs

    javac Task.java
    java -cp . Task
And if you're in and IDE (in fairness, they're not popular for quick prototypes), you're just clicking the play button either way.
Re:Python's Type Checking Renaissance by pjmlp on Wednesday January 27, 2021 @04:08AM (#25925898)
Not really given that there are REPLs for Java, C#, OCaml, Haskell, F#, Scala.

There are also toolchain options for running the code interpreted, JIT compiled, AOT compiled, or a mix of the previous options.

Languages are orthogonal to the toolchains.