On 30 November 2011 22:22, Kay Hayen <kayha...@gmx.de> wrote: > It could turn every "module.py" into a "module.so" with more or less > dubious benefits.
Note that there are a few differences between compiled and pure Python modules. E.g. - Tracebacks to errors won't show code from compiled files. - Functions assigned to a class attribute get bound to instances (i.e. get automatically passed self) if they're defined in Python, but compiled functions do not. I had to fix something recently where a standard library function had moved from pure-Python to C, and broken code that bound it to a class. - I can arbitrarily add extra attributes to instances of Python classes, but not to instances of compiled classes. Also, I occasionally go and tweak installed Python files, which is obviously impractical if they have to be translated and compiled. I know you're not suggesting we turn this on tomorrow. But I think replacing pure-python modules with compiled modules should always be a deliberate choice, not something distributions do automatically. StringIO already has compiled equivalents, of course - cStringIO, and the compiled io package in Python 2.7 and 3.x. Thomas