python 3 compatibility: new method 'use_metaclass'

This commit is contained in:
David Halter
2012-09-01 10:29:17 +02:00
parent 94f2d5e263
commit a1d3ab9094
3 changed files with 9 additions and 5 deletions

View File

@@ -106,3 +106,9 @@ try:
from functools import reduce
except ImportError:
reduce = reduce
def use_metaclass(meta, *bases):
""" Create a class with a metaclass. """
if not bases:
bases = (object,)
return meta("HackClass", bases, {})