Native Code vs. Python code for modules

pruebauno at latinmail.com pruebauno at latinmail.com
Wed Jul 30 10:30:29 EDT 2008


On Jul 29, 11:56 pm, koblas <kob... at gmail.com> wrote:
> better if there was a way that if I have an "interface compatible"
> native (aka C) module that has better performance that there could be
> a way that python would give it preference.
>
> e.g.
>
>   import random(version=1.2, lang=c)
> or
>   import random(version=1.2, lang=py)   # use the python version by
> default
> or
>   import random     #  use the latest version in the "fastest" code (C
> given preference)
>
> where there could be a nice set of "standard" key value pairs that
> could provide addtional hints as to what language and version of a
> library was to be used.

I will only make a comment on automatic cModule importing. Some of
what you are suggesting already happens (e.g. Elementree). In Python
3.0 more of the "legacy" modules (e.g. StringIO) should also work that
way. I don't know what the current status for Pickle is  because
cPickle had some additional internal functionality not available in
regular Pickle that Zope was dependent on.



More information about the Python-list mailing list