Re: Standard module implementation



On Sun, Nov 28, 2010 at 6:08 AM, candide <candide@xxxxxxxxxxxx> wrote:
I was wondering if all the standard module are implemented in C. For
instance, I can't find a C implementation for the minidom xml parser under
Python 2.6.

As was already said, no; a significant portion if not the majority of
the std lib is written in pure Python, not C.

You can usually determine how a module is implemented by looking at
the file extension of the module's __file__ attribute. For example:
$ python
Python 2.6.6 (r266:84292, Oct 12 2010, 14:31:05)
[GCC 4.2.1 (Apple Inc. build 5664)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
import cPickle # obviously in C
cPickle.__file__
'/sw/lib/python2.6/lib-dynload/cPickle.so'
import pickle # pure Python version
pickle.__file__
'/sw/lib/python2.6/pickle.pyc'

Cheers,
Chris
--
http://blog.rebertia.com
.



Relevant Pages

  • Re: About one class/function per module
    ... "the majority of programmers don't use this approach". ... You obviously don't have enough experience with Python to understand why your "organization" suck. ... (snip lots of stuff that require neither "one line of code per file" nor fancy scripts) ...
    (comp.lang.python)
  • Re: Why learn Python ??
    ... >> great majority of projects, optimisation does not require ... Most code in Python, plus small amount of C/C++ ... and that ratio applies to 90% of the project. ...
    (comp.lang.python)
  • Re: Python 3000 vs. Python 2.x
    ... learning. ... I've read that a number of significant features have ... Yet, the majority of Python ...
    (comp.lang.python)
  • Re: Why does Python never add itself to the Windows path?
    ... Unlike Unix systems, the PATH variable is rarely used. ... It is not less than the majority of Python users who deal with multiple Python versions. ... install Python to the path? ...
    (comp.lang.python)
  • Re: Python 3000 vs. Python 2.x
    ...  I've read that a number of significant features have ...  Yet, the majority of Python ... What 3rd party modules are you planning to use? ... Python 3000 versions. ...
    (comp.lang.python)