Brett Cannon added the comment:

First off, what you want to do isn't easy to begin with. =) You are right that 
you want get_code() and that SourceLoader is what you want. The problem is that 
importlib inherited PEP 302s APIs, and there are so many that the docs don't 
repeat themselves in terms of what methods each ABC implements in order to keep 
the docs readable. That makes it a little difficult to realize what ABCs 
implement what without reading the class description and/or looking at the 
class hierarchy layout to realize that SourceLoader implements ResourceLoader 
which specifies get_code().

Second, import is just plain hard. It took me over 5 years to write importlib 
and get it to where it is now, and most of that work was just trying to keep it 
all straight in my head. This also makes writing an example or two difficult as 
it becomes a massive undertaking very quickly. And there is the simple issue 
that everyone wants something different, e.g. you want to transform source 
while others want an alternative back-end storage solution. That means coming 
up with the right examples is hard in and of itself.

Third, in Python 3.4 your desire to transform source will be much easier to 
achieve thanks to http://bugs.python.org/issue15627 .

IOW, I understand your pain but solving the problem is hard without writing a 
book on the subject (which who knows, maybe I'll do someday as a $1 ebook or 
something).

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue15867>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to