Issue 8626: TypeError: rsplit() takes no keyword arguments (original) (raw)

Issue8626

Created on 2010-05-05 14:28 by dabrahams, last changed 2022-04-11 14:57 by admin. 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
2022-04-11 14:57:00 admin set github: 52872
2011-01-01 17:52:19 eric.araujo set status: open -> closedsuperseder: Document lack of support for keyword arguments in C functionsnosy: + eric.araujomessages: + resolution: duplicatestage: resolved
2011-01-01 11:33:44 sandro.tosi set nosy: + sandro.tosimessages: +
2010-05-05 20:21:51 pitrou set nosy: + docs@python, pitroumessages: + assignee: docs@pythoncomponents: + Documentationstage: test needed -> (no value)
2010-05-05 18:54:21 brett.cannon set keywords: + easystage: test needed
2010-05-05 14:28:09 dabrahams create