Should __module__ be defined as class attribute?
Open
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 5.1k
- Forks
- 2.1k
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 82
Description
This results in mypyc raising an error upon code accessing obj.__class__.__module__, which I believe is the canonical way to get the attribute. See https://github.com/mypyc/mypyc/issues/1055
Note that Cython doesn't define obj.__module__, therefore it makes difficult to write portable code.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Inspect stdlib/builtins.pyi around line 98 and review the linked mypyc issue to understand how module is currently modeled. Confirm the expected behavior for obj.class.module and account for the portability concern raised about Cython; done means the stub accurately supports the canonical access pattern.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100