Pybites · @pybites
122 followers · 100 posts · Server fosstodon.org

New article:

⚠️Why you should avoid import * in Python 🐍
pybit.es/articles/why-you-shou

Covering:
- Why modules are great and namespacing explained
- Why import * is a problem
- A practical example where a function gets overriden
- The recommended way to do imports
- What PEP8 has to say about this
- Protection workaround, use __all__ to define your module's public interface

#python #pythonprogramming #modules #encapsulation #namespacing #zenofpython #bestpractices #pitfalls #imports #dundermethods

Last updated 1 year ago