[issue29632] argparse values for action in add_argument() should be flags instead of (or in addition to) strings

2017-03-24 Thread Pedro
Changes by Pedro : -- resolution: -> wont fix stage: -> resolved status: open -> closed ___ Python tracker ___

[issue29632] argparse values for action in add_argument() should be flags instead of (or in addition to) strings

2017-03-24 Thread Pedro
Pedro added the comment: I guess I'm a little allergic to magic strings. I think there is value in greater consistency across modules, but agree it's not a big deal because the Action classes are already accessible that way. I was unaware of the details behind `action` and actually just found

[issue29632] argparse values for action in add_argument() should be flags instead of (or in addition to) strings

2017-02-23 Thread paul j3
paul j3 added the comment: Those strings are defined in a 'parser.registry' dictionary, with expressions like self.register('action', 'store', _StoreAction) (Users can also register their own custom classes. The registry can also be used for the 'type' attribute.) So you can already do:

[issue29632] argparse values for action in add_argument() should be flags instead of (or in addition to) strings

2017-02-23 Thread paul j3
Changes by paul j3 : -- nosy: +paul.j3 ___ Python tracker ___ ___ Python-bugs-list

[issue29632] argparse values for action in add_argument() should be flags instead of (or in addition to) strings

2017-02-23 Thread R. David Murray
R. David Murray added the comment: The obvious thing to do would be to make the Action subclasses have public names. I personally would continue to use the strings, though, as they are easier to type. (The same would be true if an enum were introduced (that I'd continue to use the stings

[issue29632] argparse values for action in add_argument() should be flags instead of (or in addition to) strings

2017-02-23 Thread Pedro
New submission from Pedro: The possible values for action are currently: 'store' 'store_true' 'store_false' 'store_const' 'append' 'append_const' 'count' 'help' 'version' a subclass of argparse.Action The string values are evidently for backward compatibility with optparse. However, adding the