jackfrued / jackfrued/Python-100-Days
两个下划线的作用不是用来定义类的私有属性或私有方法吧
Nobody has claimed this yet.
- Dominant language
- Jupyter Notebook
- Stars
- 187k
- Forks
- 55.8k
- PR merge metrics
- No merged PRs in 30d
Description
https://github.com/jackfrued/Python-100-Days/blob/27687762907ab6f8d2ac17c51d071dfd71229343/Day01-15/Day08/code/access.py#L4-L6
你好,你的例子提到的作用是
如果希望属性是私有的,在给属性命名时可以用两个下划线作为开头
而在这篇文章提到两个下划线的作用
防止子类继承时覆盖父类不该覆盖的方法
Contributor guide
No contributing guide indexed for this repository
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 with Day01-15/Day08/code/access.py lines 4-6 and the “访问可见性问题” section in Day01-15/Day08/面向对象基础.md. Compare the explanation of double-underscore names with the linked article’s description of subclass name collisions. Done means the lesson clearly distinguishes name mangling, access conventions, and inheritance behavior.
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
- 35/100