[New-bugs-announce] [issue13249] argparse.ArgumentParser() lists arguments in the wrong order

Roy Smith report at bugs.python.org
Sun Oct 23 20:32:39 CEST 2011

New submission from Roy Smith <roy at panix.com>:

The docs list the arguments in the order:

class argparse.ArgumentParser([description][, epilog][, prog]...

but the code (I'm looking at the 2.7.2 source) lists them as:

 class ArgumentParser(_AttributeHolder, _ActionsContainer):
   def __init__(self,

If you create a parser with just:

parser = argparse.ArgumentParser("foo")

you end up setting the 'prog' argument instead of the expected 'description'.  

It's unclear if the order in the code should be fixed to match the docs, or the order in the docs fixed to match the code, or just a note added to the docs saying you should not rely on positional argument ordering and always create a parser with named arguments.

components: Library (Lib)
messages: 146238
nosy: roysmith
priority: normal
severity: normal
status: open
title: argparse.ArgumentParser() lists arguments in the wrong order
type: behavior
versions: Python 2.7

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list