[Distutils] [Python-Dev] PEP 365 (Adding the pkg_resources module)

Phillip J. Eby pje at telecommunity.com
Wed Mar 19 17:00:02 CET 2008


At 09:43 AM 3/19/2008 +0000, Paul Moore wrote:
>On 19/03/2008, Phillip J. Eby <pje at telecommunity.com> wrote:
> >  >I don't particularly want to use undocumented functions - even within
> >  >the module that defines them.
> >
> > Er, you could always document them, you know.  I just didn't get
> >  around to it before the whole "setuptools flap of 2005" wiped out my
> >  motivation to do any further work on Python 2.5.  For the most part,
> >  they do have docstrings.  I just never did the LaTeX work on
> >  them.  And now, you can use reST instead of LaTeX.  :)
>
>I could, but the problem is I don't really follow the code. My
>motivation is to add useful functions, not document stuff that's
>already there. You mentioned using get_loader to implement
>resource_string. OK, but I'd have done something a lot simpler than
>the code of get_loader, and I don't understand why the code in there
>is necessary.

It's so that you can get loaders for modules that aren't imported yet 
-- and your code would need to handle this case too.  (You could 
handle it by actually going ahead and importing the module, as 
pkg_resources does, but there are other tools using pkgutil to e.g. 
inspect as-yet-unimported modules.)


>Never mind, I'll implement what I'm planning on using my own code, and
>ignore trying to understand the (corner cases of the) undocumented
>functions.

You don't really need to, because even though they're technically 
"undocumented", the intent was for them to be published APIs (apart 
from simplegeneric, which is an implementation detail).  The docs 
just never got copied to the official docs.  These APIs are also 
actively used by at least pydoc and pyrun in Python 2.5, so they're 
unlikely to go away or break.



More information about the Distutils-SIG mailing list