classification
Title: Wrong argument name in documentation for pipes.Template.open
Type: Stage:
Components: Documentation Versions: Python 3.9, Python 3.8, Python 3.7, Python 3.6, Python 3.5, Python 2.7
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: docs@python Nosy List: docs@python, ilai, xtreak
Priority: normal Keywords:

Created on 2019-10-16 08:13 by ilai, last changed 2019-10-16 18:28 by xtreak.

Messages (2)
msg354781 - (view) Author: Ilaï (ilai) Date: 2019-10-16 08:13
Documentation for the pipes module indicates that the second argument of open()
is "mode", but it is actually "rw".

Python 3.7.4 (default, Oct  4 2019, 06:57:26)
[GCC 9.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from pipes import Template; Template().open('/tmp/f', mode='r')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: open() got an unexpected keyword argument 'mode'

Python 2.7.16 (default, Mar 11 2019, 18:59:25)
[GCC 8.2.1 20181127] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from pipes import Template; Template().open('/tmp/f', mode='r')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: open() got an unexpected keyword argument 'mode'

https://docs.python.org/3/library/pipes.html#pipes.Template.open
msg354812 - (view) Author: Karthikeyan Singaravelan (xtreak) * (Python committer) Date: 2019-10-16 18:28
Semantically mode makes sense to me though rw is correct and Template.open docstring has rw. There are docs like unittest where the keyword arguments are slightly different from the actual keyword arguments in the assert helpers. I guess it's slightly unfortunate that Template.open got rw as keyword argument while open uses mode as keyword argument.
History
Date User Action Args
2019-10-16 18:28:17xtreaksetnosy: + xtreak
messages: + msg354812
2019-10-16 08:13:45ilaicreate