[Import-SIG] PEP 420: Implicit Namespace Packages
Nick Coghlan
ncoghlan at gmail.com
Sun Apr 22 07:26:06 CEST 2012
On Sun, Apr 22, 2012 at 11:06 AM, Eric V. Smith <eric at trueblade.com> wrote:
> Furthermore, given how __path__ is built, by one-at-a-time remembering
> the path entries that have a foo directory but no foo/__init__.py, I'm
> not sure how you'd turn that into some auto-updating iterable.
You just have to remember all your namespace packages somewhere and
then use a list subclass that triggers a rescan whenever the contents
change.
Personally, I'm happier with the basic behaviour being that
dynamically updating sys.path while the program is running can be a
bit hit-or-miss in terms of what recognises the change.
Longer term, rather than introducing magical side effects for sys.path
manipulation, I think the better solution is to expose a more
object-oriented API for manipulating the import system state that
takes care of maintaining the state invariants, invalidating caches
when appropriate and triggering updates to package __path__ entries.
Hence, PEP 406 (currently deferred) and its import engine API.
Cheers,
Nick.
--
Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia
More information about the Import-SIG
mailing list