📜  以下划线开头的变量名 python 代码示例

📅  最后修改于: 2022-03-11 14:46:59.526000             🧑  作者: Mango

代码示例1
_bar
#No effect, just hint for the user:
#“Hey, this isn’t really meant to be a part of the public interface 
#of this class.
#Best to leave it alone.”
__bar
#protects the variable from getting overridden in subclasses
__bar__
#It’s best to stay away from using names that start and 
#end with double underscores (“dunders”) in your own programs 
#to avoid collisions with future changes to the Python language.
#reserved for magic methods