[docs] [issue10871] argparse example use "file" instead of "open"

Baptiste Lepilleur report at bugs.python.org
Sun Jan 9 10:07:41 CET 2011

New submission from Baptiste Lepilleur <blep at users.sourceforge.net>:

In section " type" of the argparse module, the following code sample is given:

>>> parser = argparse.ArgumentParser()
>>> parser.add_argument('foo', type=int)
>>> parser.add_argument('bar', type=file)
>>> parser.parse_args('2 temp.txt'.split())
Namespace(bar=<open file 'temp.txt', mode 'r' at 0x...>, foo=2)

The built-in "file" used for argument 'bar' no longer exists in python 3.2.

assignee: docs at python
components: Documentation
messages: 125834
nosy: blep, docs at python
priority: normal
severity: normal
status: open
title: argparse example use "file" instead of "open"
versions: Python 3.2

Python tracker <report at bugs.python.org>

More information about the docs mailing list