jackfrued / jackfrued/Python-100-Days

两个下划线的作用不是用来定义类的私有属性或私有方法吧

Open
#131 1 comment 0 reactions 0 assignees View on GitHub

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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.