Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[doc] Wrong argument name in documentation for pipes.Template.open #82678

Open
ilai-deutel mannequin opened this issue Oct 16, 2019 · 3 comments
Open

[doc] Wrong argument name in documentation for pipes.Template.open #82678

ilai-deutel mannequin opened this issue Oct 16, 2019 · 3 comments
Labels
3.9 only security fixes 3.10 only security fixes 3.11 only security fixes docs Documentation in the Doc dir type-bug An unexpected behavior, bug, or error

Comments

@ilai-deutel
Copy link
Mannequin

ilai-deutel mannequin commented Oct 16, 2019

BPO 38497
Nosy @tirkarthi, @ilai-deutel, @iritkatriel

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = None
created_at = <Date 2019-10-16.08:13:45.086>
labels = ['3.11', 'type-bug', '3.9', '3.10', 'docs']
title = '[doc] Wrong argument name in documentation for pipes.Template.open'
updated_at = <Date 2021-11-27.00:44:38.748>
user = 'https://github.com/ilai-deutel'

bugs.python.org fields:

activity = <Date 2021-11-27.00:44:38.748>
actor = 'iritkatriel'
assignee = 'docs@python'
closed = False
closed_date = None
closer = None
components = ['Documentation']
creation = <Date 2019-10-16.08:13:45.086>
creator = 'ilai'
dependencies = []
files = []
hgrepos = []
issue_num = 38497
keywords = []
message_count = 3.0
messages = ['354781', '354812', '407123']
nosy_count = 4.0
nosy_names = ['docs@python', 'xtreak', 'ilai', 'iritkatriel']
pr_nums = []
priority = 'normal'
resolution = None
stage = None
status = 'open'
superseder = None
type = 'behavior'
url = 'https://bugs.python.org/issue38497'
versions = ['Python 3.9', 'Python 3.10', 'Python 3.11']

@ilai-deutel
Copy link
Mannequin Author

ilai-deutel mannequin commented Oct 16, 2019

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

@ilai-deutel ilai-deutel mannequin added 3.7 (EOL) end of life 3.8 only security fixes 3.9 only security fixes labels Oct 16, 2019
@ilai-deutel ilai-deutel mannequin assigned docspython Oct 16, 2019
@ilai-deutel ilai-deutel mannequin added the docs Documentation in the Doc dir label Oct 16, 2019
@tirkarthi
Copy link
Member

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.

@iritkatriel
Copy link
Member

It's documented as a positional arg:

Template.open(file, mode)
https://docs.python.org/3/library/pipes.html#pipes.Template.open

but accepts it also as the kwarg "rw".

So these are ok:
from pipes import Template; Template().open('/tmp/f', rw='r')
from pipes import Template; Template().open('/tmp/f', 'r')

And this is not:
from pipes import Template; Template().open('/tmp/f', mode='r')

@iritkatriel iritkatriel added 3.10 only security fixes 3.11 only security fixes and removed 3.7 (EOL) end of life 3.8 only security fixes labels Nov 27, 2021
@iritkatriel iritkatriel changed the title Wrong argument name in documentation for pipes.Template.open [doc] Wrong argument name in documentation for pipes.Template.open Nov 27, 2021
@iritkatriel iritkatriel added the type-bug An unexpected behavior, bug, or error label Nov 27, 2021
@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.9 only security fixes 3.10 only security fixes 3.11 only security fixes docs Documentation in the Doc dir type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

2 participants