[issue42650] Can people use dest=argparse.SUPPRESS in custom Action classes?

paul j3 report at bugs.python.org
Sun Dec 20 14:28:57 EST 2020


paul j3 <ajipanca at gmail.com> added the comment:

I'd have to study the code (and docs), but I'm not sure setting the `dest` to 'SUPPRESS' does anything meaningful.

    default=argparse.SUPPRESS

is useful, keeping the default out of the namespace.  That argument appears only if the user has used the option.

But with `dest` (in a default 'store'), I get a namespace like

    Namespace(**{'==SUPPRESS==': 'foo'})

'help' and 'version' exit right after displaying their message, so I'm no sure the 'SUPPRESS' is doing anything.  The parser doesn't return a namespace.

It appears that the 'dest' is passed to the Action.  A custom Action could act on that 'dest'.  The default 'store' just uses it as the attribute for storing the value in the namespace.

Anyways, this is not the kind of thing that we'll be tweaking in the source.  I don't recall any bug/issue touching on this behavior (but we could do a search).

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue42650>
_______________________________________


More information about the Python-bugs-list mailing list