Live data from Hacker News

Python finally offloads some batteries

lwn.net

31–40 of 67 posts

Re: Python finally offloads some batteries

#31
post #21
post #16

Earlier quoted context omitted.

This is an argument for good package management. There’s no way around it. You can’t add everything anyone could ever hypothetically need into the standard library, just because Pip is rubbish. (I mean, I don’t care. I use Rust. I’m just arguing on behalf of the poor people who are still abused by their employers, or wacky enough to voluntarily choose to use Python.)

I use Rust and Python, and I don't believe that Rust's strategies regarding standard libraries are great either. And let's not talk about Javascript "in order to use CSS with Webpack you need to download this 20 line package with its own release cycle"-style noncense. I do believe that package management solutions are needed. But I also think that a big standard library is A Good Thing, especially in a universe where…

A large "standard platform" may be a good thing, but it should definitely be decoupled from the language proper. (And personally I would say Javascript is doing it better than most languages on the library management front).

Re: Python finally offloads some batteries

#32
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 bunch of extra stuff and learn "how to run Python programs".

Re: Python finally offloads some batteries

#34

What are you supposed to use instead of urllib? Seems like an oversight to write all about how you considered removing it without saying whether there is a replacement.

From the proposal to remove urllib linked in the article:

https://lwn.net/ml/python-dev/CABqyc3wGDmdnDjrhYh0SxT_Tgr5M8...

  From:    Victor Stinner 
  To:    Python Dev   
  Subject:    [Python-Dev] It's now time to deprecate the   stdlib urllib module  
  Date:    Sun, 06 Feb 2022 15:08:40 +0100  
  Message-ID:    
  
  Hi,
  
  I propose to deprecate the urllib module in Python 3.11. It would emit
  a DeprecationWarning which warn users, so users should consider better
  alternatives like urllib3 or httpx: well known modules, better
  maintained, more secure, support HTTP/2 (httpx), etc.

Re: Python finally offloads some batteries

#35
post #27
post #5

It’s interesting to see which modules were set for deprecation but ended up being un-deprecated (de-deprecated?): colorsys fileinput getopt optparse wave https://peps.python.org/pep-0594/#modules-to-keep Seems like the maintainers have been generous in deciding which batteries are not dead yet.

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

Re: Python finally offloads some batteries

#37
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 "we don't break userspace"? Python should learn something from that.

Re: Python finally offloads some batteries

#38

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.

Re: Python finally offloads some batteries

#39

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 "…

Interesting, I’ve never seen the cgi module used before. It’s good to know it exists.

Here’s an example for those interested: https://dzone.com/articles/python-simple-http-server-with-cg...

Re: Python finally offloads some batteries

#40
post #30

Earlier quoted context omitted.

How can you have urllib2 without urllib? That would be silly

Urllib2 was renamed to urllib in python 3.

Thank $deity there's an 'urllib3' that's mostly used from 'requests' to add confusion back.
Post reply on HN