[Python-Dev] Re: [Import-sig] Re: Proposal for a modified import mechanism.

Prabhu Ramachandran Prabhu Ramachandran <prabhu@cyberwaveindia.com>
Tue, 13 Nov 2001 14:26:45 +0530


>>>>> "BAW" == Barry A Warsaw <barry@zope.com> writes:

>>>>> "PR" == Prabhu Ramachandran <prabhu@aero.iitm.ernet.in> writes:

    PR> (1) Re-nesting a package is a pain.  What I mean by re-nesting
[Re-nesting packages contrived example]

    BAW> Why would you want to do that?  Why not just keep them
    BAW> separate top-level packages that cooperate?  Or export A's
    BAW> names in B's modules?  I think distutils helps out here
    BAW> because it's now easy to install A in a way that B could just
    BAW> use, or add to.

Umm, that was a contrived example so might not be very sensible.  For
a more realistic one I think I'll pass the question on to Eric.  I
think Eric did mention his difficulty with SciPy here:

http://mail.python.org/pipermail/python-list/2001-November/071794.html

<snip>

    BAW> Why does B have to add packages to A's namespace?  Why can't
    BAW> the B author simply use distutils to ensure that vanilla A is
    BAW> installed, import the bits and pieces of A that you want to
    BAW> expose, overriding what you want to change, and export an
    BAW> interface through B that clients can use instead of A?
    BAW> I.e. through the use of "from foo import bar" and "from foo
    BAW> import bar as baz", you can present whatever public interface
    BAW> you want, through B's namespace, and mimic as much or as
    BAW> little of A's as you want.

Ture, its possible to do things and work around situations with the
current scheme.  I guess I need to come up with something that
definitively proves my point.  Will think about it.  Maybe Gordon has
a better/more convincing argument?  I think Michel Pelletier also had
a different point of view on this.

    PR> Its not the application that I'm concerned about - an
    PR> application is typically a single/few file(s) and editing them
    PR> to suit things is certainly not an issue.

    BAW> Well, not /all/ applications!

Indeed.  I guess I caused confusion here.  I was talking of my
particular application where I ran into problems with re-nesting and
too much typing I was referring to that.  I certainly don't intend
changing every single application when there is no need for that.
    
    PR> So do I need to write a PEP?  Is there some special
    PR> formality/format I need to keep in mind?

    BAW> PEP 1 and PEP 9 are your guidelines to proper PEP form and
    BAW> procedure.

Thanks.  Will look at them.

prabhu