[python-win32] Can win32com handle this one?

Tim Golden mail at timgolden.me.uk
Thu Feb 7 11:56:59 CET 2008


David Abrahams wrote:
> Is there somewhere a summary of criteria by which I'd choose win32com or
> comtypes?

Not that I know of. I offer a so-obvious-as-to-be-almost-unneeded
list here. It's entirely likely that I've misrepresented things
somewhat so I'd be very grateful for additions & editions.

==================
pywin32 (win32com)
==================

PRO: Been around for years so more mature, more stable and
more (knowledgeable) users.

PRO: For those interfaces which it *does* wrap, does most or
all of the dirty work for you.

PRO: Actively maintained

CON / PRO: Makes things so easy for the novice programmer that
they forgo any attempt to learn how COM really works... which
means that when it gets messy they don't really know what's
going on.

CON: Has dark and little known/tried corners; I think I discover
one new win32com feature every month either through this list or
from reading the source to find something else out.

CON: Occasionally shows its age, esp. wrt Unicode, datetime
and other types whiseh postdate its original conception.

CON: Only wraps those interfaces (including, critically, IDispatch)
for which its maintainers have time / inclination.


========
comtypes
========

PRO: Effectively native Python -- relies on ctypes which is
a C extension but now part of stdlib.

PRO: Actively maintained

PRO: Can, in principle, wrap any interface.

PRO: Newer / smaller so fewer dark corners and refactor-candidates.

PRO/CON: You have to understand more about the way the COM
works -- as above this has positive and negative points.

CON: Newer, so less tried-and-tested: fewer (experienced) users.

CON: You have to do the dirty work yourself; as with ctypes, more
scope for crashing Python nastily.


TJG


More information about the python-win32 mailing list