on-internet
← Community

What is the documented behaviour (if any) when someone imports `pkg.__init__[ as pkg]` instead of `import pkg`?

Stack Overflow ·

To be clear, I'm not suggesting anyone actually should import pkg.__init__ directly. This is to understand potential pitfalls if someone decides to convert a module-only distribution into a package, because the current typing specifications cannot bundle static typing information with module-only distributions. So, when someone converts project/ distributed.py into project/ distributed/ __init__.py a third party user can do this: import distributed.__init__ # and/or import distributed.__init__ as distributed I'm already aware of the following if you import distributed.__init__: Both distribute

Comments

Sign in or sign up to comment and upvote.

No comments yet.