This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author paul.j3
Recipients David.Layton, Paolo.Elvati, Stefan.Pfeiffer, bethard, eric.araujo, josh.r, manveru, mitar, paul.j3, remi.lapeyre
Date 2019-05-11.03:02:50
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1557543770.9.0.547429460172.issue13824@roundup.psfhosted.org>
In-reply-to
Content
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.)
History
Date User Action Args
2019-05-11 03:02:50paul.j3setrecipients: + paul.j3, bethard, eric.araujo, mitar, Paolo.Elvati, manveru, Stefan.Pfeiffer, David.Layton, josh.r, remi.lapeyre
2019-05-11 03:02:50paul.j3setmessageid: <1557543770.9.0.547429460172.issue13824@roundup.psfhosted.org>
2019-05-11 03:02:50paul.j3linkissue13824 messages
2019-05-11 03:02:50paul.j3create