organizing many python scripts, in a large corporate environment.

bukzor workitharder at gmail.com
Wed Mar 16 18:28:07 EDT 2011


On Mar 16, 7:42 am, booklover <bnsm... at gmail.com> wrote:
> > I'm going to try to get our solution open-sourced, then I'll get your
> > feedback on it.
>
> Thanks bukzor! I think that it would be very helpful to have a library
> like this available.
>
> In the longer term, what do people think about the possibility of
> writing up a PEP to fix this problem in the core language? Anyone have
> any ideas on the cleanest way to achieve this goal?

If we had relative imports for scripts as well as package modules,
that would be the end of it.
When the relative import escapes the current package (or module) start
using filesystem semantics, where another dot means a parent
directory, and something that looks like a package is just a
directory. This replaces the "relative import from non-package" error,
so backward-compatibility is a non-issue.

bin/parrot/speak.py:
   def say(text):
       print text

bin/parrot/mccaw.py
    #this is a script, not a module!
    from ..speak import say

bin/guy/__init__.py
    from ..parrot.speak import say





More information about the Python-list mailing list