Bug Report
Overriding _get_args() to give positional arguments for classes subclassing _AttributeHolder get printed out twice.
Example of a public API Namespace which inherits from _AttributeHolder:
from argparse import Namespace
class Foo(Namespace):
def __init__(self, bar, baz='baz'):
self.bar = bar
self.baz = baz
def _get_args(self):
return [self.bar]
print(Foo('bar'))
# Output
>>> Foo('bar', bar='bar', baz='baz')
Proposal
I was conflicted in calling this a bug, as when going through argparse this seemed more like unused code. Currently, _get_args() is unused throughout the codebase, also found no matches when searching through GitHub, and as it's private it should be safe to remove. However, to be safe, I propose to deprecate _get_args() in 3.11 and remove it at a later point.
Here's a patch to the above proposal: PR-91624
Bug Report
Overriding
_get_args()to give positional arguments for classes subclassing_AttributeHolderget printed out twice.Example of a public API
Namespacewhich inherits from_AttributeHolder:Proposal
I was conflicted in calling this a bug, as when going through
argparsethis seemed more like unused code. Currently,_get_args()is unused throughout the codebase, also found no matches when searching through GitHub, and as it's private it should be safe to remove. However, to be safe, I propose to deprecate_get_args()in 3.11 and remove it at a later point.Here's a patch to the above proposal: PR-91624