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

At 10:44 PM 3/18/2008 +0000, Paul Moore wrote:
Someone should document these new functions :-( Was it you that added them?
Yes, and it was specifically to start pulling some of that stuff out of pkg_resources so it'd be more widely available.
Assuming it was, what's the "simplegeneric" function doing in there?
It's a substitute for the adapter machinery that the corresponding code used when it lived in pkg_resources. Guido had just shot down adapting in favor of generic functions, so I used what I thought would be a more palatable name. :)
Can it be moved somewhere more sensible?
Er, sure, if you can get that past Python-Dev. It's not a particularly full-featured generic function implementation, just a crude subset of the simplegeneric that's on PyPI. If I were doing it today, I'd have called it 'trivialgeneric' instead. ;)
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. :)

On 19/03/2008, Phillip J. Eby pje@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.
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. Looking at the pkg_resources code, I'd have had the same issues there trying to disentangle the "simple bits" from the infrastructure, as you suggested, so that's probably a better approach anyway.
Paul.
participants (2)
-
Paul Moore
-
Phillip J. Eby