Message111936
| Author |
bethard |
| Recipients |
bethard, georg.brandl, travistouchdown |
| Date |
2010年07月29日.14:26:16 |
| SpamBayes Score |
0.009113706 |
| Marked as misclassified |
No |
| Message-id |
<1280413582.25.0.895622677823.issue9399@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
Should this print to stdout or stderr? I wonder if the API should allow either, and instead look like:
parser.add_argument('--license', action='write', message='...', file=sys.stdout)
Where sys.stdout would be the default for the file= argument. The action would then just literally call file.write(message), so the behavior would be pretty easy to explain.
Of course, at that point it makes me wonder if maybe it wouldn't just be better to have an easy way to have some arbitrary function called without having to subclass Action, e.g.:
parser.add_argument('--license', action='call', callable=lambda: sys.stdout.write(message))
Basically this would be a shorthand for subclassing Action when you don't need any information about the command line. |
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2010年07月29日 14:26:22 | bethard | set | recipients:
+ bethard, georg.brandl, travistouchdown |
| 2010年07月29日 14:26:22 | bethard | set | messageid: <1280413582.25.0.895622677823.issue9399@psf.upfronthosting.co.za> |
| 2010年07月29日 14:26:17 | bethard | link | issue9399 messages |
| 2010年07月29日 14:26:16 | bethard | create |
|