News for hackers. Stuff that matters.
Re:Python's “Disappointing” Superpowers by deshpand on Wednesday February 01, 2023 @09:56PM (#34621460)
A ~100k LOC project in a statically typed system with type hierarchies, interfaces, contracts and boiler plate will boil down to ~10k LOC in a dynamically typed language like Python. A 10k LOC project will be more readable than a 100k LOC project.

Source: I have spent years coding in C++/Java, then Python. I have migrated Java projects into Python

Re:Python's “Disappointing” Superpowers by Ferret7446 on Wednesday February 01, 2023 @10:33PM (#34621695)
Your problem is C++/Java, not static typing. Static typing does not add many extra lines of code. In most cases, it adds no extra lines of code, as declaring variable/param types is done inline.

Heck, just look at static typing in Python.

Re:Python's “Disappointing” Superpowers by ReflectedImage on Thursday February 02, 2023 @02:24PM (#34631773)
So Generics, Traits, Abstract subclasses, etc... don't exist in static typing?

As soon as the types get complicated, the code bloat begins.

Re:Python's “Disappointing” Superpowers by necovek on Saturday February 11, 2023 @04:43PM (#34756694)
Static typing is not only about declaring your arguments and variables as simple types (int, float, array of ints etc).

It means having a distinct type for any complex structure you pass around (think pre-normalization API params, post-normalization API params, slightly enriched post-processing data as separate type vs a dict of str to anything in Python), or anything you want to make compatible (think interfaces vs duck typing).

Re:Python's “Disappointing” Superpowers by sa46 on Wednesday February 01, 2023 @10:58PM (#34621868)
10x seems extreme. ESR went from 14k lines in Python to 21k in Go. http://www.catb.org/~esr/reposurgeon/GoNotes.html
Re:Python's “Disappointing” Superpowers by d21d3q on Thursday February 02, 2023 @04:04AM (#34624023)
I'm wondering how many of the extra lines are those containing only closing bracket
Re:Python's “Disappointing” Superpowers by deshpand on Thursday February 02, 2023 @08:32AM (#34626251)
I didn't mean to exaggerate. I think part of the improvement was the luxury of refactoring which should generally reduce the bloat. And, as someone else said, part of the issue is C++/Java, not static typing. When I move from Java to Python, I also get the luxury of organizing code into fewer/meaningful source files. I find this more readable, than having to switch to different files constantly.

I have not had a chance to learn or use a language like Go. But production use of Python, including building large code bases is real. We do resort to numba, cython or using Python API to compiled code.

I'm now involved in converting large codebases from SAS to Python. I don't think I will have the luxury of choosing another language like Go, for a number of reasons.

Re:Python's “Disappointing” Superpowers by dkarl on Thursday February 02, 2023 @10:36AM (#34627992)
It's funny, both Java and Python emerged in the 1990s, yet Java feels incredibly crusty and awkward in 2023. I wouldn't choose Java as a fair representative of statically typed languages in 2023, but Python still feels like a reasonable choice for a non-Lisp dynamic language.
Re:Python's “Disappointing” Superpowers by albertopv on Thursday February 02, 2023 @12:45AM (#34622583)
You probably were replacing LoC with libraries or syntactic sugar, you can do the same with java. As a senior I can write same functionality than juniors with half LoC. In my experience Python is totally unusable when dealing with poorly documented 3rd party libs.