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 eric.snow
Recipients Ronan.Lamy, docs@python, eric.araujo, eric.snow, lebigot, mherrmann.at, r.david.murray, terry.reedy, vstinner
Date 2012-06-14.13:40:36
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1339681237.0.0.173138588691.issue12982@psf.upfronthosting.co.za>
In-reply-to
Content
> I am not fully sure why -O is essentially required for running .pyo
> files: why not have the Python interpreter handle everything
> automatically based on the extension?

In part because it would take work to make it happen and apparently no one feels strongly enough about adding that functionality, or convinced enough that it's appropriate, to do the work.  If you're interested a good first step would be to write a PEP 302 metapath hook (finder that gets inserted to sys.metapath) that makes import of .pyo files work even when -O is not used.  Maybe you'd also want to have .pyc files work even when -O *is* used.

Keep in mind that there may be other reasons why such functionality would not go into the interpreter.  However, the beauty of import hooks is that it wouldn't matter once you have yours in hand.
History
Date User Action Args
2012-06-14 13:40:37eric.snowsetrecipients: + eric.snow, terry.reedy, vstinner, lebigot, eric.araujo, r.david.murray, docs@python, Ronan.Lamy, mherrmann.at
2012-06-14 13:40:37eric.snowsetmessageid: <1339681237.0.0.173138588691.issue12982@psf.upfronthosting.co.za>
2012-06-14 13:40:36eric.snowlinkissue12982 messages
2012-06-14 13:40:36eric.snowcreate