[Python-Dev] Replacing PyWin32's PeekNamedPipe, ReadFile, and WriteFile

Nick Coghlan ncoghlan at gmail.com
Thu Jul 23 14:13:28 CEST 2009


Christian Heimes wrote:
> By the way I don't think that ctypes is the right way to go here. ctypes
> is very handy if you need a quick solution. However I wouldn't use it as
> a permanent solution for the subprocess module. It's tricky to get
> ctypes based solutions right on multiple platforms (32 vs 64bit). It's
> harder to debug a ctypes solutions rather than a C extension, too. I
> assume that calling overhead is greater than a pure C extension.

I see ctypes as largely useful when you want to call a native DLL but
don't have any existing infrastructure for accessing native code from
your project. A few lines of ctypes code is then a much better solution
than adding a C or C++ compilation dependency just to access a couple of
functions.

Of course, that definitely isn't the case for CPython - we not only have
plenty of existing C infrastructure, but in the specific case of
subprocess on Windows we already have a dedicated extension module
(PC/_subprocess.c).

Cheers,
Nick.


-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia
---------------------------------------------------------------


More information about the Python-Dev mailing list