3.4.1 Examples

The following examples both define a Psyco-friendly class X and bind the method f.

from psyco.classes import __metaclass__
class X:
    def f(x):
        return x+1

"import __metaclass__" affects all classes defined in the module. To select individual classes instead:

import psyco.classes
class X(psyco.classes.psyobj):
    def f(x):
        return x+1