Can someone explain __all__ in Python?

前端 未结 11 2423
一个人的身影
一个人的身影 2020-11-21 13:36

I have been using Python more and more, and I keep seeing the variable __all__ set in different __init__.py files. Can someone explain what this d

11条回答
  •  再見小時候
    2020-11-21 13:53

    It's a list of public objects of that module, as interpreted by import *. It overrides the default of hiding everything that begins with an underscore.

提交回复
热议问题