<br><br><div class="gmail_quote">On Tue, Jan 12, 2010 at 04:29, Michael Foord <span dir="ltr"><<a href="mailto:fuzzyman@voidspace.org.uk">fuzzyman@voidspace.org.uk</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div text="#000000" bgcolor="#ffffff"><div class="im">
On 12/01/2010 12:16, Barry Warsaw wrote:
<blockquote type="cite">
<pre>On Jan 11, 2010, at 09:57 PM, Steven Bethard wrote:
</pre>
<blockquote type="cite">
<pre>Actually there's a solution to this one too:
FooBase = Meta('FooBase', (), {})
class Foo(FooBase):
...
That should work in Python 2.X and 3.X.
</pre>
</blockquote>
<pre>Ugly, but good call! :)
</pre>
</blockquote>
<br></div>
There are all sorts of tricks. For example you can do exception
handling that works with pre-2.6 syntax and 3.0 with a bare except and
using sys.exc_info. It is horrible, but acceptable for short pieces of
code (I have a couple of small modules that do this).<br>
<br>
I haven't yet tried converting larger code-bases to Python 3, but I
think the workflow advocated by Martin is greatly preferable to the
hacks and tricks needed to make the same codebase run under 2 & 3.<br><br></div></blockquote><div><br></div><div>In other words we need to pull together a HOWTO for Python source like the one for extension modules that Benjamin wrote and make it rather prominently linked from the Python 3 documentation index page.</div>
<div><br></div><div>-Brett</div></div>