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 idank
Recipients idank
Date 2012-10-05.14:53:20
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1349448801.58.0.783623579173.issue16142@psf.upfronthosting.co.za>
In-reply-to
Content
When known and unknown options are given together in the same option string (e.g. -xy) then ArgumentParser behaves in a strange way:

- if the known option is given first (so -k is known and the parser is fed with ['-ku']) then the parsing aborts with "error: argument -k/--known: ignored explicit argument 'u'"

- if the unknown option is given first then both options are treated as unknown and returned in the list of remaining arguments.

This makes it impossible to use parse_known_args for its intended purpose because every single letter option might be interleaved with other unknown options.

I attached a test script that demonstrates this.
History
Date User Action Args
2012-10-05 14:53:21idanksetrecipients: + idank
2012-10-05 14:53:21idanksetmessageid: <1349448801.58.0.783623579173.issue16142@psf.upfronthosting.co.za>
2012-10-05 14:53:21idanklinkissue16142 messages
2012-10-05 14:53:20idankcreate