O'Reilly logo

Expert Python Programming - Second Edition by Tarek Ziadé, Michał Jaworski

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Namespace packages

The Zen of Python, which you can read by writing import this in the interpreter session, says the following about namespaces:

Namespaces are one honking great idea—let's do more of those!

And this can be understood in at least two ways. The first is a namespace in the context of the language. We all use namespaces without even knowing:

  • The global namespace of a module
  • The local namespace of the function or method invocation
  • The built-in name's namespace

The other kind of namespaces can be provided at packaging levels. These are namespaced packages. This is often an overlooked feature that can be very useful in structuring the package ecosystem in your organization or in a very large project.

Why is it useful?

Namespace packages can ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required