[Python-Dev] PEP 420 - dynamic path computation is missing rationale (original) (raw)
Nick Coghlan ncoghlan at gmail.com
Tue May 22 17:41:46 CEST 2012
- Previous message: [Python-Dev] PEP 420 - dynamic path computation is missing rationale
- Next message: [Python-Dev] PEP 420 - dynamic path computation is missing rationale
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Wed, May 23, 2012 at 1:39 AM, Nick Coghlan <ncoghlan at gmail.com> wrote:
def recalculate(self): # If parentpath has changed, recalculate path parentpath = tuple(self.parentpath()) # Retrieve and make a copy if parentpath != self.lastparentpath: loader, newpath = self.pathfinder(self.name, parentpath) # 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 = newpath self.lastparentpath = parentpath # 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
- Previous message: [Python-Dev] PEP 420 - dynamic path computation is missing rationale
- Next message: [Python-Dev] PEP 420 - dynamic path computation is missing rationale
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]