[issue12642] 2.6.6 documentation of the open() built-in function

Jann Eike Kruse report at bugs.python.org
Tue Jul 26 23:20:19 CEST 2011


New submission from Jann Eike Kruse <python at jannkruse.de>:

The documentation page 

http://docs.python.org/release/2.6.6/library/functions.html?highlight=open#open

describes the  open()  built-in function as

  open(filename[, mode[, bufsize]])

but the Python interpreter complains:

  Python 2.6.6 (r266:84292, Dec 27 2010, 00:02:40) 
  [GCC 4.4.5] on linux2 
  Type "help", "copyright", "credits" or "license" for more information.
  >>> 
  >>> 
  >>> file_descriptor = open(filename='/spam')
  Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
  TypeError: Required argument 'name' (pos 1) not found
  >>> 
  >>> 
  >>> file_descriptor = open(name='/spam', bufsize=-1)
  Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
  TypeError: 'bufsize' is an invalid keyword argument for this function
  >>> 
  >>> 
  >>> file_descriptor = open(name='/spam', buffering=-1)
  Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
  IOError: [Errno 2] No such file or directory: '/spam'
  >>> _
  

So the documentation page should read

  open(name[, mode[, buffering]])
       ----          ---------

instead, note 'name' not 'filename' and 'buffering' not 'bufsize'.

Maybe it's relevant, because Debian/stable still ships with
Python 2.6.6 and I guess the Python 2.7.x documentation has 
the same bug.

The """docstring""" does already reflect that correctly.


PS:
This is my first bug report. I hope I did this right. 
Mercy, please! ;)

----------
assignee: docs at python
components: Documentation
messages: 141183
nosy: docs at python, jannkruse
priority: normal
severity: normal
status: open
title: 2.6.6 documentation of the  open()  built-in function
versions: Python 2.6

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue12642>
_______________________________________


More information about the Python-bugs-list mailing list