2 years ago
#68323
figs_and_nuts
When is __package__ not present?
PEP366 states:
The major proposed change is the introduction of a new module level attribute,
__package__
. When it is present, relative imports will be based on this attribute rather than the module name attribute.
Will it ever be the case that it is not present? I know it can be None
, ''
, or __name__.rpartition('.')[0]
but, will it ever be that referencing __package__
will throw me an attribute not found error? Is it safe to say that __package__
is always present actually?
python
python-import
0 Answers
Your Answer