On 07/07/2010 16:29, Alexander Belopolsky wrote:
[snip...]

4. Does not ctypes make it possible to replace a method of a Python-coded
class with a faster C version, with something like
  try:
    connect to methods.dll
    check that function xyx exists
    replace Someclass.xyy with ctypes wrapper
  except: pass
For instance, the SequenceMatcher heuristic was added to speedup the
matching process that I believe is encapsulated in one O(n**2) or so
bottleneck method. I believe most everything else is O(n) bookkeeping.

The ctypes modules is very CPython centric as far as I know.   For the
new modules, this may be a valid way to rapidly develop accelerated
versions.   For modules that are already written in C, I don't see
much benefit in replacing them with ctypes wrappers.



Nope, both IronPython and PyPy have ctypes implementations and Jython is in the process of "growing" one. Using ctypes for C extensions is the most portable way of providing C extensions for Python (other than providing a pure-Python implementation of course).

Michael

--
http://www.ironpythoninaction.com/
http://www.voidspace.org.uk/blog

READ CAREFULLY. By accepting and reading this email you agree, on behalf of 
your employer, to release me from all obligations and waivers arising from any 
and all NON-NEGOTIATED agreements, licenses, terms-of-service, shrinkwrap, 
clickwrap, browsewrap, confidentiality, non-disclosure, non-compete and 
acceptable use policies (”BOGUS AGREEMENTS”) that I have entered into with your 
employer, its partners, licensors, agents and assigns, in perpetuity, without 
prejudice to my ongoing rights and privileges. You further represent that you 
have the authority to release me from any BOGUS AGREEMENTS on behalf of your 
employer.


_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to