Psyco Decorator (See related posts)

This will cause decorated functions to be run using the psyco optimizer. It will allow the code to continue working even if psyco is not available

Decorator:
try:
    import psyco
except:
    pass

def optimize(func):
    try:
        return psyco.proxy(func)
    except:
        return func


Usage:
@optimize
def complex_function(n):
    ... do complex stuff with n ...

You need to create an account or log in to post comments to this site.


Related Posts