GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — `argparse.BooleanOptionalAction` silently failed when used with parser whose `prefix_chars` has no `'-'` · Issue #138525 · python/cpython Closed Labels stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-featureA feature request or enhancementA feature request or enhancement DescriptionBug reportBug description:
>>> from argparse import BooleanOptionalAction, ArgumentParser >>> # normal usage >>> p = ArgumentParser() # prefix_chars defaults to '-' >>> p.add_argument("--foo", action=BooleanOptionalAction) BooleanOptionalAction(option_strings=['--foo', '--no-foo'], dest='foo', nargs=0, const=None, default=None, type=None, choices=None, required=False, help=None, metavar=None, deprecated=False) >>> p.parse_args(['--no-foo']) Namespace(foo=False) >>> >>> # parser with customized prefix_chars >>> p = ArgumentParser(prefix_chars='+') >>> p.add_argument("++foo", action=BooleanOptionalAction) BooleanOptionalAction(option_strings=['++foo'], dest='foo', nargs=0, const=None, default=None, type=None, choices=None, required=False, help=None, metavar=None, deprecated=False) Raising warning/error is expected when CPython versions tested on:3.14 Operating systems tested on:macOS Linked PRsActivity
MetadataMetadataAssigneesLabelsstdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-featureA feature request or enhancementA feature request or enhancement Projects
MilestoneRelationshipsDevelopmentIssue actions |
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |