Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> I have no idea how anyone lives with it for anything except writing extremely repetitive, formulaic, and superficial code, because having to dig into its guts feels like a nightmare.

It’s interesting that Python powers an outsized chunk of contemporary scientific research.

Perhaps its fitness for purpose is a result of its messiness, or perhaps that messiness maps better to the way that many people think? Would a more rigorously-typed alternate-universe Python have been as successful?



> Would a more rigorously-typed alternate-universe Python have been as successful?

One of the reasons Python became popular was its reputation as “executable pseudocode”. Rigorous typing would detract from that.

Guido and the authors of Mypy clearly believe that now the language is popular, it can afford to add explicit types and become less like pseudocode. But I don’t think it would have become as popular had it taken this direction from the beginning.


> One of the reasons Python became popular was its reputation as “executable pseudocode”. Rigorous typing would detract from that.

Not necessarily, if it had good type inference. I write Scala that looks pretty close to Python (unfortunately the community as a whole makes extensive use of symbolic names, which I think is a mistake, but you can avoid those libraries), and with Scala 3's indentation-based syntax it can become even more so.


> I write Scala that looks pretty close to Python

Interesting. I’ve never used Scala - do you have any example code available?


Hmm, now that I look at it my personal code is mostly gnarly functional libraries. https://github.com/m50d/plus-minus-zero/ is probably the project that's closest to something I'd do in Python, but I've still used a fancy reactive library and some functional tools for dealing with the explicit async futures.

(It's a quick calculator tool to compute your European Mahjong Associaton rank score based on your tournament results, and can import your existing results through some quick and dirty web scraping. The domain linked from github has expired, but it's running at https://adoring-khorana-c20461.netlify.app/ - Scala usually runs on the JVM but this build is set up to compile to JS and run in the browser).


> Would a more rigorously-typed alternate-universe Python have been as successful?

Yes, perhaps even moreso. It certainly would've been easier for alternative implementations like PyPy.

Maybe even easier to make the transition to Python3 if the interface had been better designed.

But, hey, with all its faults I still think it's really great and deserves a lot of credit. That said, it could be a good time for Nim or some other new language to shine.


You make the common assumption that success is caused by property, rather than by the most important criterion of “right place at the right time”.

It would not surprise me at all that in an alternate universe, the exact same language was released a mere six months later, and was forgotten into obscurity.

Microsoft is undeniably the giant it is today largely because at that exact moment IBM needed a cheap operating system for it's line of personal computers and that Bill Gates' parent at the time worked for IBM and could arrange that deal certainly also helped.

The success of many giant companies can be traced to a pivotal event that was sheer dumb luck — for FedEx, this event was actually gambling in a casino with what money they had left when they were close to bankruptcy.


You are right about cause of many things with that observation.

I fully agree that you can trace the shape and popularity of C# to many specific "place and time" business events.

However Python is different. Whent it got traction it wasn't the only thing around, and it's usage over the years follows the curve that no other language is following.

Because of that I believe there's more to Python popularity than just circumstances of its birth and development.


IMO it's because researchers like it, because you can slap together some super sloppy hacky mess prototype and it will usually work. More germain languages stop you from from generating pure chaos.

Researchers also love excel, Fortran, and Matlab. Let that sink in for a bit.

Bring the downvotes hahaha


This is true. I primarily write research code as well as some code that goes to prod.

I love writing Python for exactly the reason you've mentioned. If something that needs to be re-written in a "proper" language, we've guys that can write that thing in them quickly and I don't need to worry about them that much. Did I mention those guys usually gets paid half as much as I do? As long as things work man.


  > Did I mention those guys usually gets paid half as much as I do?
You certainly did! Congratulations on being a more valuable person than a software engineer.


I think he's software engineer too. Just the one who's paid more for figuring what to write, not how to write it.


Matlab (Octave), Fortran, Python, Excel - congratulations, you have won our Masters of Computational Physics language bingo!

(Well, there's also C, LabView, SQL and Java, but they are less prominent.)


So, which is it, "will usually work" or "pure chaos"?


> Would a more rigorously-typed alternate-universe Python have been as successful?

Maybe at some point we'll get TypedPython (like we got TypeScript).

In my opinion that's the way language design should be done.

First discover what semantic people want to use to express themselves and if you got that right enough then try to describe that semantic with a type system as rich as you need to let people express themselves more precisely.

Starting with designing typesystem is too hard and leads to fiasco that kept Haskell in obscurity and spawned whole slew of dynamic languages.

Although maybe we got better at making flexible enough type systems... Rust seems to be doing a lot of stuff right.


We already have TypedPython. It's called Mypy, and any organization doing serious or larger scale Python development should already have this hooked up to their CI.

Together with Pycharm you get almost same level of fearless refactoring only C# or Java can offer.

It's a bit shocking to see people not using it or not even being aware of it's existence, because without it large codebases quickly become a steaming pile of unsafe mess.


Agreed, strict use of mypy with editor support is a game changer (particularly its union types and TypedDict)




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: