Ask HN: Why Python good for web development?

2 points by bryk ↗ HN

4 comments

[ 2.7 ms ] story [ 17.6 ms ] thread
because of reasons
Dude, keep the comments constructive.

And to answer the question, it's mostly preference as to what language and stack to use.

Preference includes reasoning from: -Personal language preference -Available frameworks(and maturity of them for stability and support reasons) -Integration into existing code

OK for real. :-)

I've always liked Python for web dev because it is a good general purpose language, it's elegant, and has good web frameworks. Some other languages are really good at the web but not much useful outside of that. So with Python if you are building something with data analytics and the web it's a perfect choice. Python pairs well with a lot of areas. It doesn't pair with everything well, such as, Javascript I think pairs better with robotics. And there are other good general purpose languages too (Javascript, Java, etc).

I'm what you might call a lifelong Python programmer; I discovered it as a teenager in the 90s when Red Hat's install tool broke and I dug into the source code. My previous experience was with C and Basic. I saw Python 1.x and was immediately hooked.

I've learned of course other languages; some I hate (Php) some I like (Go), but I always keep coming back to Python.

To me, Python finds a pleasant equilibrium between the heft and rigidity of something like Java and the carelessness of Php or JavaScript. Most simple operations are obvious and the native types that have direct literals cover the vast majority of your needs (dicts, lists, tuples, etc).

Then you get into meta-programming. With weakrefs and metaclasses, you can write things like ORMs without the hyper-verbosity you'd get with other languages.

For me, the main downside of Python is distribution/packaging. It's gotten a lot better with WSGI, Docker, and virtualenv/pipenv, but one of the consistent struggles I've had as someone proposing a Python-based solution is installation/deployment. Back in the bad old days, I jokingly said to a colleague we should embed the entire Python interpreter inside Php somehow so we wouldn't have to walk clients through installing our webapp.

Another notable downside of Python is that while under_scores are the agreed upon standard, plenty of libraries use camelCase, which can be irritating. And over time, there have been some misnomers in package names and curious gotchas. But among languages of its age, Python is remarkable for how cleanly it has aged.