This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author zerkms
Recipients docs@python, zerkms
Date 2019-11-19.02:23:43
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
At this moment it's impossible to explain the behaviour of this script using documentation.

Given it was explicitly coded to behave like that - it should be somehow noted in the documentation, that as long as a `` field has a default value set already - it won't be overwritten with a default argparse argument value.

import argparse

class CliArgs(object):
    foo: str = 'not touched'

parser = argparse.ArgumentParser()
parser.add_argument('--foo', default='bar')

args = CliArgs()
print( # 'not touched'

print(parser.parse_args()) # 'bar'
Date User Action Args
2019-11-19 02:23:43zerkmssetrecipients: + zerkms, docs@python
2019-11-19 02:23:43zerkmssetmessageid: <>
2019-11-19 02:23:43zerkmslinkissue38843 messages
2019-11-19 02:23:43zerkmscreate