PyWin32 for Python 3.x

John Machin sjmachin at lexicon.net
Mon Mar 16 01:43:30 EDT 2009


On Mar 16, 7:27 am, Tim Golden <m... at timgolden.me.uk> wrote:

[snip]

> people take to categorise their packages appropriately. It
> could well be the case that a number of packages will work
> in Python 3.x without modification but their entry probably
> won't reflect that unless their maintainer's gone to the
> trouble to test the package and update it.

Excuse me, but what I read in this newsgroup, supported by my
experience doing a triage port followed by a fullscale practice port
on each of 2 non-trivial packages that I maintain (xlrd and xlwt),
suggests that the likelihood of a pure Python module (let alone
package) working with Python 3.X (even after going through 2to3)
without modification is rather low ... unless it was rather small and
had been written expressly to work unchanged in 2.X and 3.X. [1] It's
been stated authoritatively that the subset of Python that will run
unchanged unported un2to3ed is "crippled". Many packages support old
versions of Python (xlrd back to 2.1; some of the effbot's goodies
(e.g. PIL) run on 1.5.2 even), increasing the effort required to
assess the scope of the port, let alone implement it.

IOW any package that isn't specified as being 3.X-ready is unlikely to
be 3.X-ready. And if it was ready, wouldn't you want to wait till the
maintainer had tested that it was, and published its readyness?

> Obviously, in the case of (Windows) extension modules,
> the module will at the very least need recompiling and
> rebuilding even if the code works without modification.

I could be wrong, but I got the impression that the C-API had changed
significantly from 2.x to 3.X and module initialisation had changed
drastically ... see (for example) http://docs.python.org/3.0/howto/cporting.html#cporting-howto
... Looks to me like the chance of any extension (Windows or not) not
requiring changes is zero.

[1]: I've written a pure-Python module for calculating Levenshtein
distance using a bit-parallel algorithm; it will work on 3.x unchanged
because it operates on two sequences which need to support only seq[x]
and len(seq) and whose elements need to be hashable and comparable and
not much else, and it doesn't import anything. This is very small,
recent, and deliberate, hence definitely not the norm.

Cheers,
John



More information about the Python-list mailing list