Namespace vs regular package

前端 未结 3 1640
灰色年华
灰色年华 2020-12-01 05:40

What\'s the difference between a namespace Python package (no __init__.py) and a regular Python package (has an __init__.py), especially when

3条回答
  •  余生分开走
    2020-12-01 06:17

    1. Having __init__.py makes it so you can import that package elsewhere.
    2. Also, the __init__.py file can contain code you want executed each time the module is loaded.

提交回复
热议问题