Nimp: Nested Imports (a la Java)
Tomer Filiba
tomerfiliba at gmail.com
Sat Jun 18 05:41:23 EDT 2011
Stefan Behnel <stefan_ml <at> behnel.de> writes:
>
> So, this isn't really about "nested imports" but rather about merging
> distinct packages, right? This allows me to let packages that are stored in
> different places appear within their common package prefix.
yes, in lack of a better name, i chose "nested packages", in the sense that they
are "logically nested" into one another.
> Does is really require the "-" naming convention for packages, or would it
> also work with normal directories? E.g.
>
> ...path1/org/humbug/test/...
> ...path2/org/humbug/toast/...
the current code doesn't support this -- of course it's easy to do, but it
raises some issues. for instance, i didn't want Nimp to get in the way of
"normal" python packages, i.e., i want the regular import mechanism to take care
of those. also, as you said yourself, there's a question of multiple __init__.py
files. and alternative apporach is http://packages.python.org/distribute/setuptools.html#namespace-packages --
which simply disallows any code in __init__.py except for their boilerplate.
> That seems like a more common use case: different install directories, egg
> directories and zip files that contain the same prefix package directories.
>
> I guess there are issues with "__init__.py" files in this case, though -
> which ones should be executed if the package structure is multiplied?
>
> Stefan
>
>
-tomer
More information about the Python-list
mailing list