[issue24739] allow argparse.FileType to accept newline argument

2021-10-25 Thread paul j3
paul j3 added the comment: Adding `newline` to `FileType` requires modifying both the `__init__` and `__call__` methods. That's nearly the whole class. I'd copy and edit, and forget about subclassing. -- ___ Python tracker

[issue24739] allow argparse.FileType to accept newline argument

2021-10-25 Thread Mitar
Mitar added the comment: I think the issue is that it is hard to subclass it. Ideally, call to open would be made through a new _open method which would then call it, and one could easily subclass that method if/when needed. -- nosy: +mitar ___

[issue24739] allow argparse.FileType to accept newline argument

2017-04-19 Thread Berker Peksag
Berker Peksag added the comment: I agree with paul j3. It would be nice to keep the current FileType API as is. The argparse documentation already encourages people to write their own custom types and I think this is a good use case for following the advice. Thanks for the report! --

[issue24739] allow argparse.FileType to accept newline argument

2017-03-27 Thread AlbertZhuang
Changes by AlbertZhuang : -- pull_requests: +750 ___ Python tracker ___ ___

[issue24739] allow argparse.FileType to accept newline argument

2015-08-03 Thread paul j3
paul j3 added the comment: argparse.FileType serves 2 purposes - handling filenames for simple quick shell-like scripts - as a model for custom 'types', specifically one that uses a class to generate the desired type callable. Other bug-issues show that it hasn't aged well. It doesn't work

[issue24739] allow argparse.FileType to accept newline argument

2015-07-27 Thread Gary Peck
New submission from Gary Peck: argparse.FileType should support a newline argument that corresponds to the newline parameter to open(). In addition to more closely mirroring the open() API, this is also needed to properly use argparse.FileType with csv.reader() or csv.writer() (which require