serhii.net

In the middle of the desert you can say anything you want

13 Jan 2022

Python package import patterns link + __init__ stuff

This looks really interesting! It’s not about the syntax, but about the basic design philosophies + examples of packages that use it.

What’s init for me? Designing for Python package imports | Towards Data Science

Other stuff I learned about __init__.py:

  • You can use it to enforce import order 1
  • You can use it to declare package variables
  • Automatically import modules from a package2

Stuff I discovered:

  • You can set a breakpoint in pdb physically into an __init__.py, and for example look at the stack of what called it with w
Nel mezzo del deserto posso dire tutto quello che voglio.
comments powered by Disqus