Skip to content
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

Decouple FunctionDef from Lambda #291

Closed
PCManticore opened this issue Dec 12, 2015 · 3 comments
Closed

Decouple FunctionDef from Lambda #291

PCManticore opened this issue Dec 12, 2015 · 3 comments
Labels
Minor 💅 Polishing astroid is always nice
Milestone

Comments

@PCManticore
Copy link
Contributor

They share some common code through inheritance such as display_type and scope_lookup, leading to a weird ontology where a Lambda is an ancestor of a FunctionDef, while they should be in fact switched.

>>> node = FunctionDef()
>>> isinstance(node, Lambda) # should be false
>>> node = Lambda()
>>> isinstance(node, FunctionDef) # should be true
@PCManticore PCManticore added the Minor 💅 Polishing astroid is always nice label Dec 12, 2015
PCManticore added a commit that referenced this issue Jan 3, 2016
This means that checks such as ``isinstance(node, Lambda)`` will not
hold true anymore for Functions.
Closes #291
@jacobtylerwalls jacobtylerwalls added this to the 3.0 milestone May 1, 2022
@jacobtylerwalls
Copy link
Member

Consider merging 95f8a87 in astroid 3.0 after auditing uses of isinstance(x, nodes.Lambda) which will behave differently (see e.g. pylint-dev/pylint#6479)

@jacobtylerwalls
Copy link
Member

But contrary to the top of the issue, do not necessarily make Lambda inherit from FunctionDef.

@jacobtylerwalls
Copy link
Member

Fixed in #2115, thanks @DanielNoord!

@jacobtylerwalls jacobtylerwalls modified the milestones: 3.0, 2.16.0 Apr 23, 2023
@Pierre-Sassoulas Pierre-Sassoulas modified the milestones: 2.16.0, 3.0 Apr 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Minor 💅 Polishing astroid is always nice
Projects
None yet
Development

No branches or pull requests

3 participants