Skip to content

TypeError: rsplit() takes no keyword arguments #52872

Closed

Description

@dabrahams
mannequin
BPO 8626
Nosy @pitrou, @merwok, @sandrotosi, @dabrahams
Superseder
  • bpo-8350: Document lack of support for keyword arguments in C functions
  • 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 = <Date 2011-01-01.17:52:19.552>
    created_at = <Date 2010-05-05.14:28:09.581>
    labels = ['easy', 'docs']
    title = 'TypeError: rsplit() takes no keyword arguments'
    updated_at = <Date 2011-01-01.17:52:19.550>
    user = 'https://github.com/dabrahams'

    bugs.python.org fields:

    activity = <Date 2011-01-01.17:52:19.550>
    actor = 'eric.araujo'
    assignee = 'docs@python'
    closed = True
    closed_date = <Date 2011-01-01.17:52:19.552>
    closer = 'eric.araujo'
    components = ['Documentation']
    creation = <Date 2010-05-05.14:28:09.581>
    creator = 'dabrahams'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 8626
    keywords = ['easy']
    message_count = 4.0
    messages = ['105040', '105084', '124997', '125003']
    nosy_count = 5.0
    nosy_names = ['pitrou', 'eric.araujo', 'sandro.tosi', 'docs@python', 'dabrahams']
    pr_nums = []
    priority = 'normal'
    resolution = 'duplicate'
    stage = 'resolved'
    status = 'closed'
    superseder = '8350'
    type = None
    url = 'https://bugs.python.org/issue8626'
    versions = []

    Activity

    1. dabrahams commented on May 5, 2010

      dabrahamsmannequin
      MannequinAuthor

      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.

    2. pitrou commented on May 5, 2010

      @pitrou
      Member

      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.

    3. added
      docsDocumentation in the Doc dir
      on May 5, 2010
    4. sandrotosi commented on Jan 1, 2011

      @sandrotosi
      Contributor

      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

    5. merwok commented on Jan 1, 2011

      @merwok
      Member

      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.

    6. transferred this issue fromon Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    No one assigned

      Labels

      docsDocumentation in the Doc direasy

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions