Message166068
| Author |
bethard |
| Recipients |
David.Layton, Paolo.Elvati, Stefan.Pfeiffer, bethard, eric.araujo, manveru |
| Date |
2012年07月21日.21:01:08 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1342904469.62.0.227464954844.issue13824@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
So I generally agree that FileType is not what you want for anything but quick scripts that can afford to either leave a file open or to close stdin and/or stdout. However, quick scripts are an important use case for argparse, so I don't think we should get rid of FileType.
What should definitely happen:
* Someone should add some documentation explaining the risks of using FileType (e.g. forgetting to close the file, or closing stdin/stdout when you didn't mean to).
What could potentially happen if someone really wanted it:
* Someone could create a "safe" replacement, e.g. a FileOpenerType that returns an object with open() and close() methods that do the right things (or whatever API makes sense). |
|