On Tue, 08 Feb 2005 10:24:28 -0800, Michael Spencer wrote: > How about: > > >>> def fact_ge(n): > ... f = [1] > ... f.extend(i*j for i,j in it.izip(xrange(1,1+n), f)) > ... return f > ... > >>> fact_ge(10) > [1, 1, 2, 6, 24, 120, 720, 5040, 40320, 362880, 3628800] > >>> > > as a "stateful" genexp?
That's not a generator expression, that's a generator function. Nobody contests they can reference earlier states, that's most of their point :-) For context, we're trying to build Turing Completeness into Python without indentation. I bailed out of a Xah Lee thread because people have probably killed it :-) and this is entirely unrelated by now, except in the vague sense he started with an (I'm sure entirely accidentally) thought-provoking question. -- http://mail.python.org/mailman/listinfo/python-list