am i correct in thinking that psyco will just not accelerate, rather than break code it cannot deal with? that has been a pretty standard import on all my programs tom
Ziga Seilnacht wrote: > [EMAIL PROTECTED] wrote: > > im plugging away at the problems at > > http://www.mathschallenge.net/index.php?section=project > > im trying to use them as a motivator to get into advanced topics in > > python. > > one thing that Structure And Interpretation Of Computer Programs > > teaches is that memoisation is good. > > all of the memoize decorators at the python cookbook seem to make my > > code slower. > > is using a decorator a lazy and inefficient way of doing memoization? > > can anyone point me to where would explain how to do it quickly. or is > > my function at fault? > > Your problem is that you are mixing psyco and memoize decorators; > psyco cannot accelerate inner functions that use nested scopes (see > http://psyco.sourceforge.net/psycoguide/unsupported.html ). > You could try using the memoize decorator from: > http://wiki.python.org/moin/PythonDecoratorLibrary , > which doesn't use functions with closures, or use Fredrik Lundh's > solution which puts memoization directly into the function. > > Ziga -- http://mail.python.org/mailman/listinfo/python-list