pylint-dev / pylint-dev/astroid

Improve the way how .getattr works

Open
#93 0 comments 1 reaction 0 assignees View on GitHub
Enhancement ✨
Dominant language
Python
Stars
582
Forks
357
Avg merge
1d 1h
Merged PRs (30d)
23

Description

Originally reported by: **Claudiu Popa (BitBucket: [PCManticore](http://bitbucket.org/PCManticore), GitHub: @PCManticore)**

---

There's a very good reference on how the dot access works, for classes, instances and metaclasses (http://blog.ionelmc.ro/2015/02/09/understanding-python-metaclasses/).
It would be nice if Class.getattr would behave similarly, meaning that its return value should respect mro at least (it currently doesn't do this). This could fix a couple of false positives in pylint (https://bitbucket.org/logilab/pylint/issue/354/cannot-infer-constructor-arguments-with might be an example of this)

---
- Bitbucket: https://bitbucket.org/logilab/astroid/issue/93

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with Class.getattr and compare its current behavior with the referenced description of Python dot access for classes, instances, and metaclasses. Verify how the return value currently handles method resolution order, then confirm that the behavior addresses the linked pylint false-positive example.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.