More Python module loading simplification

Slightly faster checking to see if a module is in a package.
Issue #848
This commit is contained in:
William S Fulton 2018-12-18 07:50:48 +00:00
commit 355395200f
2 changed files with 4 additions and 4 deletions

View file

@ -6282,7 +6282,7 @@ The code is generated into the pure Python module, foo.py, and merely imports th
<div class="targetlang">
<pre>
if __package__ or __name__.rpartition('.')[0]:
if __package__ or '.' in __name__:
from . import _foo
else:
import _foo
@ -6367,7 +6367,7 @@ The default import loading code is thus different:
<div class="targetlang">
<pre>
if __package__ or __name__.rpartition('.')[0]:
if __package__ or '.' in __name__:
from ._foo import *
else:
from _foo import *