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.

classification
Title: argparse example use "file" instead of "open"
Type: Stage:
Components: Documentation Versions: Python 3.2
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: docs@python Nosy List: blep, docs@python, georg.brandl
Priority: normal Keywords:

Created on 2011-01-09 09:07 by blep, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (2)
msg125834 - (view) Author: Baptiste Lepilleur (blep) Date: 2011-01-09 09:07
In section "14.4.3.6. 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.
msg125837 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2011-01-09 09:31
Thanks, this is now fixed in r87891.
History
Date User Action Args
2022-04-11 14:57:11adminsetgithub: 55080
2011-01-09 09:31:14georg.brandlsetstatus: open -> closed

nosy: + georg.brandl
messages: + msg125837

resolution: fixed
2011-01-09 09:07:39blepcreate