5 ms·
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
by genmud 5y ago
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 https://github.com/python/cpython/blob/main/Lib/argparse.py
- sigg3 5y agoThank you. I thought I was crazy for feeling it was too complex.
- akvadrako 5y agoArgparse 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.
- jwilk 5y agoLink to the bug?
- akvadrako 5y agohttps://bugs.python.org/issue17050 https://bugs.python.org/issue17050 Apparently after 7 years they decided it can't be fixed and updated the docs.
- jwilk 5y agoI'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.%5DREMAINDER%5Cb https://codesearch.debian.net/search?q=%5Cbargparse%5B.%5DRE...
- deleted 5y ago[deleted]
- __del__ 5y agoi 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).