Python leading underscore _variables

后端 未结 2 1891
野的像风
野的像风 2020-12-06 10:09

We know that in a class, functions starting with __function__ do not get imported while using:

from module import *

Someone as

相关标签:
2条回答
  • 2020-12-06 10:34

    A variable name starting with an underscore is a strong hint that this variable should be viewed as private.

    Read http://docs.python.org/tutorial/classes.html#private-variables

    0 讨论(0)
  • 2020-12-06 10:40

    It is a naming convention for private variables. See 9.6, private variables: http://docs.python.org/tutorial/classes.html#private-variables

    0 讨论(0)
提交回复
热议问题