Message342153
While I continue to follow argparse issues, I'm not doing development (with my own repository, etc).
I haven't revisited the issue since 2013, and don't know that much more about Python file handling. Occasionally 'FileType' issues come up on StackOverflow, and my most common suggestion is accept a string, and open the file yourself.
In writing a solution, keep backward compatibility foremost in mind. We don't want to mess things up for existing code. And keep FileType simple, consistent with Steven's original intent - as a tool for simple input/output scripts.
As for the idea of
2 - Making the argument namespace itself support context management
someone could experiment with a new Namespace class with the proper enter/exit methods. The use of a custom Namespace class is documented
https://docs.python.org/3/library/argparse.html#the-namespace-object
So the idea can be implemented and thoroughly tested without altering the default Namespace class and its use. (With one caution, subparsers won't use this custom class.) |
|
Date |
User |
Action |
Args |
2019-05-11 03:02:50 | paul.j3 | set | recipients:
+ paul.j3, bethard, eric.araujo, mitar, Paolo.Elvati, manveru, Stefan.Pfeiffer, David.Layton, josh.r, remi.lapeyre |
2019-05-11 03:02:50 | paul.j3 | set | messageid: <1557543770.9.0.547429460172.issue13824@roundup.psfhosted.org> |
2019-05-11 03:02:50 | paul.j3 | link | issue13824 messages |
2019-05-11 03:02:50 | paul.j3 | create | |
|