Export to GitHub

python-incompatibility - issue #2

Add tests for metaclass syntax differences


Posted on Dec 1, 2008 by Massive Kangaroo

Lennart - great idea doing this. I've been doing some testing work on a package due to be released on 3.0 (it will support 2.x from the same code base) and I'm glad to find someone putting these differences into concrete tests with annotations.

You alluded to the difference in metaclass syntax; there definitely is a difference, a subtle one which some folks may not see at first since the old metaclass = SomeMetaClass syntax will silently fail - in >= Python 3 that's just an attribute, not a special hook.

There is an approach to basing a class off a metaclass which will work in both 2.x and 3.x:

http://mikewatkins.ca/2008/11/29/python-2-and-3-metaclasses/

Nothing revolutionary or new in what I've proposed.

Cheers Mike

Comment #1

Posted on Dec 1, 2008 by Quick Kangaroo

Cool, thanksm, I'll look into that.

Status: New