On Wed, 07 Jul 2010 16:39:38 +0100 Michael Foord <fuzzy...@voidspace.org.uk> wrote: > 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).
Except that ctypes doesn't help provide C extensions at all. It only helps provide wrappers around existing C libraries, which is quite a different thing. Which, in the end, makes the original suggestion meaningless. Regards Antoine. _______________________________________________ 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