Carl Cerecke wrote:
> It turns out that generators are more efficient than the eval function
> excuting bits of compiled code. About 20-25% faster.
why are you using generators to return things from a function, when
you can just return the things ?
def f_on():
print "on"
action = next_action()
if action == 'lift':
return f_on
elif action == 'push':
return f_off
def f_off():
print "off"
action = next_action()
if action == 'lift':
return f_on
elif action == 'push':
return f_off
state = f_on
while state:
state = state()
</F>
--
http://mail.python.org/mailman/listinfo/python-list