[issue34865] Incorrect assignment of optional argument when partial match with different argument found.
New submission from Rob Dalton : Parsing an unknown optional argument whose leading characters (e.g. '--user') match those of another, known optional argument (e.g. '--userdata') causes the unknown argument to be parsed as the known one. For example - passing the unknown argument '--user' to a parser with the known argument '--userdata' assigns the passed '--user' value to '--userdata'. Here's my setup info: Python: Python 3.6.3 :: Anaconda custom (64-bit) OS: MacOS High Sierra 10.13.6 Wrote up some example cases here: https://gist.github.com/rob-dalton/9ec06b8d5e2e9083713ddc7884d16072 -- components: Library (Lib) messages: 326824 nosy: rob-dalton priority: normal severity: normal status: open title: Incorrect assignment of optional argument when partial match with different argument found. type: behavior versions: Python 3.6 ___ Python tracker <https://bugs.python.org/issue34865> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue34865] Incorrect assignment of optional argument when partial match with different argument found.
Rob Dalton added the comment: It does. Thanks! I feel dumb for not finding that. Guess I'd just suggest making the default `false`, seems more intuitive to me. On Mon, Oct 1, 2018 at 2:00 PM Robert Dalton wrote: > It does. Thanks! I feel dumb for not finding that. > > Guess I'd just suggest making the default `false`, seems more intuitive to > me. > > On Mon, Oct 1, 2018 at 1:48 PM Zachary Ware > wrote: > >> >> Zachary Ware added the comment: >> >> Would using `allow_abbrev=False` fix this for you? >> >> https://docs.python.org/3/library/argparse.html#allow-abbrev >> >> -- >> nosy: +zach.ware >> >> ___ >> Python tracker >> <https://bugs.python.org/issue34865> >> _______ >> > > > -- > Best, > Rob Dalton > > > (814) 571-0462 | robdalton.me | robcdal...@gmail.com > -- Best, Rob Dalton (814) 571-0462 | robdalton.me | robcdal...@gmail.com -- ___ Python tracker <https://bugs.python.org/issue34865> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com