Skip to content

Permit subscripting additional builtin classes #1572

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

Merged
merged 3 commits into from
May 23, 2022

Conversation

jacobtylerwalls
Copy link
Member

@jacobtylerwalls jacobtylerwalls commented May 22, 2022

Description

Treat other classes such as enumerate and staticmethod identically to list, dict, tuple, set, frozenset.

>>> enumerate[2]  # not sure why, but...
enumerate[2]
>>> type(enumerate[2])
<class 'types.GenericAlias'>

Type of Changes

Type
✨ New feature

Related Issue

Noticed while working on #1567.

Treat other clasess such as enumerate and staticmethod identically to list, dict, tuple, set, frozenset.
@jacobtylerwalls jacobtylerwalls added this to the 2.12.0 milestone May 22, 2022
@coveralls
Copy link

coveralls commented May 22, 2022

Pull Request Test Coverage Report for Build 2371212303

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • 4 unchanged lines in 2 files lost coverage.
  • Overall coverage increased (+0.02%) to 91.907%

Files with Coverage Reduction New Missed Lines %
astroid/nodes/scoped_nodes/scoped_nodes.py 1 92.4%
astroid/interpreter/_import/spec.py 3 98.25%
Totals Coverage Status
Change from base Build 2367082861: 0.02%
Covered Lines: 9221
Relevant Lines: 10033

💛 - Coveralls

@jacobtylerwalls jacobtylerwalls added the Enhancement ✨ Improvement to a component label May 22, 2022
Copy link
Member

@Pierre-Sassoulas Pierre-Sassoulas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@DanielNoord
Copy link
Collaborator

Not sure if we should call this "dubious". Seems to be a conscious decision, see:
python/cpython#83662 and python/cpython#19421

Strangely I don't see enumerate discussed in the PEP so perhaps this is indeed "dubious" I don't know.

@jacobtylerwalls jacobtylerwalls merged commit 8d5cefa into pylint-dev:main May 23, 2022
@jacobtylerwalls jacobtylerwalls deleted the enumerate-subscript branch May 23, 2022 12:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement ✨ Improvement to a component
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants