Safe Psyco

Aahz aahz at pythoncraft.com
Mon Oct 14 00:44:33 EDT 2002


In article <mailman.1034559858.6104.python-list at python.org>,
Delaney, Timothy <tdelaney at avaya.com> wrote:
>> 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.

That only works if you do *ALL* your bindings for your application in
one spot.  The problem is that you only get ImportError once per
application invocation.
-- 
Aahz (aahz at pythoncraft.com)           <*>         http://www.pythoncraft.com/

Project Vote Smart: http://www.vote-smart.org/



More information about the Python-list mailing list