Steven D'Aprano <st...@remove-this-cybersource.com.au> writes on 10 Nov 2009 19:11:07 GMT: > ... > > So I am trying to restructure it using lazy evaluation. > > Oh great, avoiding confusion with something even more confusing.
Lazy evaluation may be confusing if it is misused. But, it may be very clear and powerful if used appropriately. Lazy evaluation essentially means: you describe beforehand how a computation should be performed but do this computation only when its result is immediately required. Of course, this makes it more difficult to predict when the computation actually happens -- something potentially very confusing when the computation has side effects. If the computation is side effect free, potentially great gains can be achieved without loss of clarity. Python supports lazy evaluation e.g. by its genenerators (and generator expressions). Its "itertools" module provides examples to efficiently use iterators (and by inclusion generators) without sacrificing clarity. -- Dieter -- http://mail.python.org/mailman/listinfo/python-list