realpython / realpython/python-guide
Add class attribute to common gotchas
Open
Nobody has claimed this yet.
- Dominant language
- Batchfile
- Stars
- 29.8k
- Forks
- 5.9k
- PR merge metrics
- No merged PRs in 30d
Description
such as
class A(object):
data = {}
>>> a = A()
>>> a.data.update({'a': 1})
>>> b = A()
>>> print b.data
{'a': 1}
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
Start in the guide's common gotchas section and review how similar examples are organized. Add an explanation and example showing that a class-level mutable attribute is shared between instances; done means the gotcha is clearly documented in that section.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100