News for hackers. Stuff that matters.
Re:Python finally offloads some batteries by divbzero on Thursday March 17, 2022 @08:50PM (#30717491)
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.

Re:Python finally offloads some batteries by __del__ on Thursday March 17, 2022 @11:24PM (#30718452)
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 process pcm audio data without a whole framework

Re:Python finally offloads some batteries by genmud on Friday March 18, 2022 @12:26AM (#30718735)
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 by akvadrako on Friday March 18, 2022 @04:12AM (#30719712)
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 by jwilk on Friday March 18, 2022 @04:46AM (#30719896)
Link to the bug?
Re:Python finally offloads some batteries by akvadrako on Friday March 18, 2022 @05:06AM (#30719981)
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 by jwilk on Friday March 18, 2022 @01:45PM (#30725237)
I'm baffled with the resolution of this bug. Removing the docs doesn't help anybody.

In my experience, argparse.REMAINDER works reasonably well, and apparently I'm not alone; there's >100 packages in Debian that use it:

https://codesearch.debian.net/search?q=%5Cbargparse%5B.%5DRE...

Re:Python finally offloads some batteries by __del__ on Monday March 21, 2022 @12:47AM (#30750402)
i suppose they are both broken, but i claim optparse is "more broken" because it lacks the nargs="+" and nargs="?" functionality, and doesn't support positional arguments.

it's also valid to suggest that a plate of spaghetti is better than a cauldron full (thus favoring optparse).

Re:Python finally offloads some batteries by sigg3 on Friday March 18, 2022 @01:41AM (#30719069)
Thank you. I thought I was crazy for feeling it was too complex.
Re:Python finally offloads some batteries by tines on Thursday March 17, 2022 @08:52PM (#30717505)
precated :)
Re:Python finally offloads some batteries by naniwaduni on Thursday March 17, 2022 @09:57PM (#30717948)
comprecated?
Re:Python finally offloads some batteries by gxt on Friday March 18, 2022 @09:21AM (#30721860)
Resurected