Skip to content

Conversation

StefanM-TT
Copy link
Contributor

allows the definiton of "_" as function in builtins (e.g via typeshed).

fixes issue #9802

Description

Fixes #9802

Test Plan

allows the definiton of "_" as function in builtins (e.g via typeshed).

fixes issue python#9802
Copy link
Member

@sobolevn sobolevn left a comment

Choose a reason for hiding this comment

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

Can you please also add a test case to make sure that this feature works as intended? 🙂

table = b.node.names
if name in table:
if name[0] == "_" and name[1] != "_":
if len(name) > 1 and name[0] == "_" and name[1] != "_":
Copy link
Member

Choose a reason for hiding this comment

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

Question: why would we need to define _ as a function in __builtins__? There's no such function as far as I remember.

The original issue was about a custom module, not __builtins__.

Copy link
Member

Choose a reason for hiding this comment

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

@hauntsaninja hauntsaninja merged commit 9d5ef72 into python:master Dec 21, 2021
@hauntsaninja
Copy link
Collaborator

Thank you!

(I was happy to merge without a dedicated test, not really worth a custom builtins stub)

tushar-deepsource pushed a commit to DeepSourceCorp/mypy that referenced this pull request Jan 20, 2022
allows the definition of "_" as function in builtins (e.g via typeshed).

fixes python#9802
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Can't use _ in typeshed

4 participants