| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
There was a problem hiding this comment.
@serhiy-storchaka This looks good. Thanks for the detailed comments too.
Sorry, something went wrong.
| Check membership in :data:`~dis.hasarg` instead. | ||
| (Contributed by Irit Katriel in :gh:`109319`.) | ||
|
|
||
| * :mod:`getopt` and :mod:`optparse`: |
There was a problem hiding this comment.
Do we typically remove from the What's New for the version introduced or do we annotate that it is being changed in 3.14?
Sorry, something went wrong.
There was a problem hiding this comment.
This is an interesting question. Obviously undeprecation should be retroactive. There is no sense in discouraging the use of getopt and optparse in 3.12 and 3.13. For 3.13, this may even be considered a bugfix.
But how to indicate this in What's New? If say nothing, then users will continue to think that getopt and optparse are deprecated. If write about this in 3.12 and 3.13, most users will not read this. So we should write something in 3.14, even if this change will be applied to 3.12 and 3.13.
Sorry, something went wrong.
There was a problem hiding this comment.
I don't have a good answer to this. Perhaps @hugovk would like to weigh in as release manager.
Sorry, something went wrong.
There was a problem hiding this comment.
@Yhg1s is the 3.13 RM so punting to him :)
However, optparse was deprecated back in 3.2, some 13 years ago, so for one of them, this isn't a sudden change in 3.13.
If we do undeprecate, perhaps adding a note to the existing "What's New in 3.13" entry to note it's future change?
In any case, I would also hold off merging this and allow some more time for the discussion, it's not yet been 24 hours:
https://discuss.python.org/t/getopt-and-optparse-vs-argparse/69618
Sorry, something went wrong.
There was a problem hiding this comment.
In drafting my PR, I took the view that 3.13 is new enough that most of the people who will read the What's New haven't actually read it yet, and hence just changed this to a regular 3.13 What's New entry for optparse (getopt is reverting to the 3.12 status quo, so it only got mentioned in NEWS).
Sorry, something went wrong.
Co-authored-by: Carol Willing <carolcode@willingconsulting.com>
Co-authored-by: Martin Panter <vadmium@users.noreply.github.com>
Co-authored-by: Martin Panter <vadmium@users.noreply.github.com>
Co-authored-by: Martin Panter <vadmium@users.noreply.github.com>
|
I missed that @serhiy-storchaka had already started on a PR for this, so #126227 is an alternative take on the same change which goes a bit further than this one does in some respects, but not as far in others:
I like some of the other changes Serhiy has included here, so I'm going to include them to the other PR with a Co-Authored-By note. I've also added the DO-NOT-MERGE label to both PRs, as I agree with @hugovk that we want to let the discussion on this play out for a while longer yet. |
Sorry, something went wrong.
There was a problem hiding this comment.
I'm definitely in favour of the general idea, but had drafted my own PR before I saw the notification that Serhiy had started this one. I prefer the overall structure of my PR (it splits out a new docs chapter for "Command Line Interface Libraries"), so I added several of Serhiy's content changes as Co-Authored-By additions over there, rather than suggesting my structural changes here.
Sorry, something went wrong.
|
@serhiy-storchaka Are you cool with @ncoghlan's approach or do you want to work together to refine either one of the existing PRs? |
Sorry, something went wrong.
|
I am fine with either option, but I think that optparse should not be downplayed. For now, it is the safest option for beginners. argparse is too risky. |
Sorry, something went wrong.
|
@serhiy-storchaka Perhaps we can separate the two concerns? I think there's a piece the two of us agree on, and a piece where we still disagree (at least for now):
There are lots of CLIs where the problem of argparse mishandling leading - characters (and any similar issues) simply won't come up, because those kinds of names don't occur in practice (e.g. very few people using leading underscores in file names, so if your only options with value parameters accept file names, it probably doesn't matter to you that argparse handles them strangely). While there are places where it might make sense for people to use optparse directly, I think it's limited to the following:
We've spent ~15 years of telling people to use argparse over optparse, and the GitHub code search results suggest that by and large people have either been happy with that recommendation, or else sought out third party solutions like click. It might be reasonable to include those third party recommendations in the argparse docs (in addition to having them in the optparse docs), but I don't think we'd be genuinely helping people by directing them to the lower level optparse API unless they already knew what they were doing. Edit: Serhiy clarified on the other PR that my assumption that mishandling leading - characters was the only problematic argparse quirk is incorrect. That does strengthen Serhiy's point that the underlying problem with argparse is that when it fails, it can often be because it is behaving unreasonably, not because it is being asked to do something unreasonable, leading beginners to think they're the ones at fault, when the problem is really with argparse's behaviour being quirky. |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
📚 Documentation preview 📚: https://cpython-previews--126186.org.readthedocs.build/