A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2010-May/100251.html below:

[Python-Dev] __package__ attribute

[Python-Dev] __package__ attribute [Python-Dev] __package__ attributeAndrew Svetlov andrew.svetlov at gmail.com
Fri May 21 20:18:00 CEST 2010
What are expected values for module.__package__?
I see two different behaviors: importlib and standard python import.
importlib processes __package__ pretty simple and clean:
- for toplevel modules __package__ is empty string
- for packages it's package name
- for modules inside packages it's again package name

Standard import follows another strategy:
- it tries to setup __package__ only in case of relative import (see
first 'if' in import.c:get_parent)
- otherwise __package__ is untouched and None by default.

For me importlib's way is better.
I don't see any PEP specifying __package__ behavior.
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4