[New-bugs-announce] [issue10981] options starting with -- match substrings

David Caro report at bugs.python.org
Sat Jan 22 13:49:12 CET 2011


New submission from David Caro <david.caro.estevez at gmail.com>:

When parsing option like --optionname, --option will match it too

example:

>>> import argparse
>>>  parser = argparse.ArgumentParser()
>>> parser = argparse.ArgumentParser()
>>> parser.add_argument('--superstring')
_StoreAction(option_strings=['--superstring'], dest='superstring', nargs=None, const=None, default=None, type=None, choices=None, help=None, metavar=None)
>>> parser.parse_args(['--super','value'])
Namespace(superstring='value')

I'm using argparse 1.1 with python 2.6.6 (r266:84292, Sep 15 2010, 15:52:39), on ubuntu 10.10 32bit

----------
messages: 126833
nosy: David.Caro
priority: normal
severity: normal
status: open
title: options starting with -- match substrings

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue10981>
_______________________________________


More information about the New-bugs-announce mailing list