Skip to content

Bad dunder name is flagging __index__ #8613

Closed
@Redoubts

Description

@Redoubts

Bug description

consider

class X:
    def __index__(self):
        return 1

this will flag index as a bad dunder, even though it is valid to do.

Configuration

No response

Command used

pylint x.py

Pylint output

************* Module x
x.py:2:4: W3201: Bad or misspelled dunder method name __index__. (bad-dunder-name)

Expected behavior

no lint

Pylint version

% pylint --version
pylint 2.17.2
astroid 2.15.4
Python 3.10.11 (main, Apr 10 2023, 08:08:57) [GCC 8.3.0]

OS / Environment

No response

Additional dependencies

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    False Positive 🦟A message is emitted but nothing is wrong with the codeNeeds PRThis issue is accepted, sufficiently specified and now needs an implementation

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions