classification
Title: TypeError: rsplit() takes no keyword arguments
Type: Stage: resolved
Components: Documentation Versions:
process
Status: closed Resolution: duplicate
Dependencies: Superseder: Document lack of support for keyword arguments in C functions
View: 8350
Assigned To: docs@python Nosy List: dabrahams, docs@python, eric.araujo, pitrou, sandro.tosi
Priority: normal Keywords: easy

Created on 2010-05-05 14:28 by dabrahams, last changed 2011-01-01 17:52 by eric.araujo. This issue is now closed.

Messages (4)
msg105040 - (view) Author: Dave Abrahams (dabrahams) Date: 2010-05-05 14:28
Based on the rsplit documentation, I'd expect

  'foo bar'.rsplit(maxsplit=1)

to work.  This is probably a much bigger problem than just rsplit, i.e. I doubt there is a policy about whether documented parameter names need to be usable as keywords, and if not, how one finds out which keywords are supported.
msg105084 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2010-05-05 20:21
This is more of a documentation issue than anything else. The fact that the argument is named "maxsplit" and accepts a default value doesn't mean it's usable as a keyword argument. It would be difficult to document a parameter without giving it a name anyway...

As a rule of thumb, methods accepting 2 parameters or less often don't accept any keyword arguments, since there's no point in doing so.

I suggest closing this issue.
msg124997 - (view) Author: Sandro Tosi (sandro.tosi) * (Python committer) Date: 2011-01-01 11:33
That's interesting: do we have a place where we explain how to read the doc? I mean, a place were we can provide example/explain how we write docs, so f.e.:

  str.rsplit([sep[, maxsplit]])  

is a description for a method that could accept 2 optional arguments, none of them keyargs or

  str.encode(encoding="utf-8", errors="strict")

is a description for a method that could take 2 optional args, and they are also keyargs (yeah, I know it's kinda bad-worded, but just to give the idea).

If you think it's overkill, let's just close this bug (after all, we have all the doc written our way ;)).

Cheers,
Sandro
msg125003 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2011-01-01 17:52
The description for the function directive is at http://docs.python.org/dev/documenting/markup.html  However, I’m not sure whether the doc is accurate, since there was a switch from spam([style]) to spam(style=None) some time ago, for example in r73291.

Let’s continue the discussion on the other bug.
History
Date User Action Args
2011-01-01 17:52:19eric.araujosetstatus: open -> closed

superseder: Document lack of support for keyword arguments in C functions

nosy: + eric.araujo
messages: + msg125003
resolution: duplicate
stage: resolved
2011-01-01 11:33:44sandro.tosisetnosy: + sandro.tosi
messages: + msg124997
2010-05-05 20:21:51pitrousetnosy: + docs@python, pitrou
messages: + msg105084

assignee: docs@python
components: + Documentation
stage: test needed -> (no value)
2010-05-05 18:54:21brett.cannonsetkeywords: + easy
stage: test needed
2010-05-05 14:28:09dabrahamscreate