Live data from Hacker News

Python finally offloads some batteries

lwn.net

41–50 of 67 posts

Re: Python finally offloads some batteries

#41
post #35
post #27

Earlier quoted context omitted.

i mostly agree with those choices. colorsys: a small handful of conversion functions you need every now and then fileinput: quick and dirty boilerplate for when you want to accept input from files or stdin getopt: a fine, well understood command line parser optparse: it's a simpler more broken argparse that will eventually tell you "i'm sorry dave..." and people should stop using it wave: great way to create or proce…

I disagree that optparse is more broken than argparse. As someone who wanted to add some (trivial) features to argparse, I quickly backed away from that code [1]. To be honest, I was really surprised how needlessly complex that particular code is. [1] - https://github.com/python/cpython/blob/main/Lib/argparse.py

Thank you. I thought I was crazy for feeling it was too complex.

Re: Python finally offloads some batteries

#42

Does anyone actually have normal users run Python programs? I thought programming was intended so that users could run your programs. But if a regular non-programming user wants to use a Python program, they need a whole tutorial on how to install and run it. Put everything in the standard library, or nothing at all, it doesn't really matter. Either way you still have to set up a custom environment and install a bunc…

Not sure what this is really on about, you can easily run a python program opaquely to a user by packaging it as an executable… or simply including #!/usr/bin/env python3 in a shell file and then `chmod +x script.py` on Linux. But to answer your question, yes, millions of people run Python programs without ever knowing anything about Python.

[deleted]

Re: Python finally offloads some batteries

#43

Does anyone actually have normal users run Python programs? I thought programming was intended so that users could run your programs. But if a regular non-programming user wants to use a Python program, they need a whole tutorial on how to install and run it. Put everything in the standard library, or nothing at all, it doesn't really matter. Either way you still have to set up a custom environment and install a bunc…

Not sure what this is really on about, you can easily run a python program opaquely to a user by packaging it as an executable… or simply including #!/usr/bin/env python3 in a shell file and then `chmod +x script.py` on Linux. But to answer your question, yes, millions of people run Python programs without ever knowing anything about Python.

[deleted]

Re: Python finally offloads some batteries

#44

Does anyone actually have normal users run Python programs? I thought programming was intended so that users could run your programs. But if a regular non-programming user wants to use a Python program, they need a whole tutorial on how to install and run it. Put everything in the standard library, or nothing at all, it doesn't really matter. Either way you still have to set up a custom environment and install a bunc…

Lots of people use python apps and not know about it. I don't get where the idea that it's complicated comes from. You run them the same way as everything else. For example if you use anything redhat-based you're running a python app (https://github.com/rpm-software-management/dnf). If you're running any desktop environment, you're likely using at least one python app or something with python scripting embedded.

Re: Python finally offloads some batteries

#45

This is stupid. I use cgi all the time. My cheap Hetzner single core vps can fork a Linux process 10k times a second, so I don't want to hear about forking being too slow until Django can serve pages that fast. Cgi is still the simplest way to get a basic web script running, without worrying about lingering state between page hits, etc. Doesn't Linus always shut down such discussions regarding the Linux kernel with "…

[deleted]

Re: Python finally offloads some batteries

#46
post #35
post #27

Earlier quoted context omitted.

i mostly agree with those choices. colorsys: a small handful of conversion functions you need every now and then fileinput: quick and dirty boilerplate for when you want to accept input from files or stdin getopt: a fine, well understood command line parser optparse: it's a simpler more broken argparse that will eventually tell you "i'm sorry dave..." and people should stop using it wave: great way to create or proce…

I disagree that optparse is more broken than argparse. As someone who wanted to add some (trivial) features to argparse, I quickly backed away from that code [1]. To be honest, I was really surprised how needlessly complex that particular code is. [1] - https://github.com/python/cpython/blob/main/Lib/argparse.py

Argparse is also broken. It's not possible to create an argument that captures all remaining arguments even though the docs say it is.

There has been an open bug for this for many years.

Re: Python finally offloads some batteries

#47
post #35

Earlier quoted context omitted.

I disagree that optparse is more broken than argparse. As someone who wanted to add some (trivial) features to argparse, I quickly backed away from that code [1]. To be honest, I was really surprised how needlessly complex that particular code is. [1] - https://github.com/python/cpython/blob/main/Lib/argparse.py

Argparse is also broken. It's not possible to create an argument that captures all remaining arguments even though the docs say it is. There has been an open bug for this for many years.

Link to the bug?

Re: Python finally offloads some batteries

#48
post #47

Earlier quoted context omitted.

Argparse is also broken. It's not possible to create an argument that captures all remaining arguments even though the docs say it is. There has been an open bug for this for many years.

Link to the bug?

https://bugs.python.org/issue17050

Apparently after 7 years they decided it can't be fixed and updated the docs.

Re: Python finally offloads some batteries

#49

Earlier quoted context omitted.

I often wonder how many businesses often need code to operate. Back in school we had a database design class where the prof asked us to design a system for a user base of 50 something users per year. We were all dumbfounded when our react/postgres/python stacks were overkill when the prof explained that pen and paper or excel would’ve sufficed

reminds me of an interview I had a couple days ago where the interviewers wanted me to design an app for a 50 person building. I suggested a monolithic server side web app that serves html with minimal JS and they were expecting load balancers, multiple az, microservices, react, sharded db. lmao

[deleted]

Re: Python finally offloads some batteries

#50
Good, but let's talk about the other side of things: Features missing from Python's standard library.

Here are some features I miss regularly and I believe should be part of the standard library:

- support for modern compression algorithms (e.g. brotli, zstandard)

- support for modern hashing algorithms (e.g. argon2, bcrypt)

- support for parsing ISO 8601 date times with "Z" as timezone designator

- a TTL-cache implementation (like cachetools offers)

- support for reading/writing YAML

Post reply on HN