This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author brett.cannon
Recipients Julian, brett.cannon, docs@python, eric.snow, ncoghlan
Date 2012-09-06.15:54:12
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1346946854.71.0.573682859679.issue15867@psf.upfronthosting.co.za>
In-reply-to
Content
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).
History
Date User Action Args
2012-09-06 15:54:14brett.cannonsetrecipients: + brett.cannon, ncoghlan, docs@python, Julian, eric.snow
2012-09-06 15:54:14brett.cannonsetmessageid: <1346946854.71.0.573682859679.issue15867@psf.upfronthosting.co.za>
2012-09-06 15:54:14brett.cannonlinkissue15867 messages
2012-09-06 15:54:12brett.cannoncreate