Safe Psyco

Delaney, Timothy tdelaney at avaya.com
Mon Oct 14 03:43:24 CEST 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