[Python-Dev] PEP 420 - dynamic path computation is missing rationale
Nick Coghlan
ncoghlan at gmail.com
Tue May 22 17:41:46 CEST 2012
On Wed, May 23, 2012 at 1:39 AM, Nick Coghlan <ncoghlan at gmail.com> wrote:
> def _recalculate(self):
> # If _parent_path has changed, recalculate _path
> parent_path = tuple(self._parent_path()) # Retrieve and make a copy
> if parent_path != self._last_parent_path:
> loader, new_path = self._path_finder(self._name, parent_path)
> # Note that no changes are made if a loader is returned, but we
> # do remember the new parent path
> if loader is None:
> self._path = new_path
> self._last_parent_path = parent_path # Save the copy
> return self._path
Oops, I also meant to say that it's probably worth at least issuing
ImportWarning if a new portion with an __init__.py gets added - it's
going to block all future dynamic updates of that namespace package.
Cheers,
Nick.
--
Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia
More information about the Python-Dev
mailing list