Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #63532 > unrolled thread
| Started by | Terry Reedy <tjreedy@udel.edu> |
|---|---|
| First post | 2014-01-08 18:20 -0500 |
| Last post | 2014-01-08 18:20 -0500 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.lang.python
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: argparse action on default values Terry Reedy <tjreedy@udel.edu> - 2014-01-08 18:20 -0500
| From | Terry Reedy <tjreedy@udel.edu> |
|---|---|
| Date | 2014-01-08 18:20 -0500 |
| Subject | Re: argparse action on default values |
| Message-ID | <mailman.5206.1389223231.18130.python-list@python.org> |
On 1/8/2014 1:20 PM, Florian Lindner wrote:
> I use argparse from Python 3.3.3 with a custom action that normalizes
> path arguments:
> This works fine when there is actually a --config=path supplied. But
> it's not being applied on default arguments.
This behavior is how I interpret the doc.
http://docs.python.org/3/library/argparse.html#the-add-argument-method
"action - The basic type of action to be taken when this argument is
encountered at the command line."
"default - The value produced if the argument is absent from the command
line."
> Of course, I could use "default = norm_path('~/.foobar/config')"
Do that.
> but I expect that custom actions are applied to default values as well.
See doc quote.
> The store action works alike for default and supplied values.
It would make no sense to ignore defaults. There may be some
undocumented subtleties in the interaction of defaults and actions.
--
Terry Jan Reedy
Back to top | Article view | comp.lang.python
csiph-web