Safe Psyco

Delaney, Timothy tdelaney at avaya.com
Sun Oct 13 21:43:24 EDT 2002


> From: mertz at gnosis.cx [mailto:mertz at gnosis.cx]
> 
>     try:
>         import psyco
>         from psyco.classes import *
>     except ImportError:
>         class _psyco:
>             def jit(self):      pass
>             def bind(self, f):  pass
>             def proxy(self, f): return f
>         psyco = _psyco()

I just do it the following way:

try:
    import psyco
    psyco.bind(Klass)
    psyco.bind(func)
except ImportError:
    pass

i.e. doing all my binding in the one spot.

Tim Delaney




More information about the Python-list mailing list