Python 3
John Arbash Meinel
john at arbash-meinel.com
Wed Jun 23 00:02:05 BST 2010
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
> As for the extension guidelines, 'meh'. For reference they are:
> --
...
> It is not recommended to try to write source code that runs unchanged
> under both Python 2.6 and 3.0; you’d have to use a very contorted
> coding style, e.g. avoiding print statements, metaclasses, and much
> more. If you are maintaining a library that needs to support both
> Python 2.6 and Python 3.0, the best approach is to modify step 3 above
> by editing the 2.6 version of the source code and running the 2to3
> translator again, rather than editing the 3.0 version of the source
> code.
> --
a) We actually try to avoid 'print' since we really want to be writing
to specific file output (and print >>foo is pretty ugly anyway)
b) we don't really use metaclasses. I know we use __new__ in one or two
places (revspec), but really only because we wanted to compatibly raise
an error if someone used __init__ directly.
>
> We haven't really ignored them - we are ported to 2.6, we have
> fantastic test coverage. Folk who are doing Python 3 work can use the
> -3 switch; I'm interested here in how we enable those folk to have an
> easy life, not in the mechanics of actually doing the work - that is a
> separate, albeit related, problem.
> 2to3 is a problem for us. Here's the problem:
> - folk will want 3 before there are no platforms that have python2.x
> and not python3.x support.
> - 2to3 means an indeterministic program is actually run
> - I like to be able to properly support things
> - distros would prefer to ship a single 'bzr' package rather than two
> separate ones - and because they run with precompiled files not
> writable by the user...
>
> python2to3 is essentially useless to us. IMNSHO. Its a great tool for
> understanding *the first pass* of what needs to be changed, but not
> for actually having a supported result.
>
> As for the 'not recommended' clause - the *Python 3* release manager
> has submitted patches to another project - testtools - that does
> precisely that, a single source that works. And its actually pretty
> nice.
>
> -Rob
I'll just note that PyQt has some v3 support, nad it causes some real
headaches for the Windows installer. Because the code is listed in a
conditional import (something like: if sys.? > (2, 5, ...) import py3).
It means that py2exe wants to include that code, but can't even import
it without getting an exception.
I don't know what that would mean for us, but splitting the codebase
there wasn't nice for some 3rd party tools.
John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAkwhQO0ACgkQJdeBCYSNAAO69QCg2AZ5Emu6rX0oKdb4horr3kNU
wNwAn0xPqDUCrvkEDpCx37eMN/xQrGzT
=MioC
-----END PGP SIGNATURE-----
More information about the bazaar
mailing list