Jeremy Bowers wrote:


That's not a generator expression, that's a generator function. Nobody contests they can reference earlier states, that's most of their point :-)



Are you sure?

I just wrote my examples in functions to label them

Here's your example with this method:
 >>> import itertools as it
 >>> results = [0]
 >>> magicGenerator = (i+1 for i,lastresult in it.izip(xrange(5),results))
 >>> results.extend(magicGenerator)
 >>> results
[0, 1, 2, 3, 4, 5]
 >>>

> 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 :-)
Didn't see it, but this looked interesting - presumably your point
and this is entirely unrelated by now, except in
> the vague sense he started with an (I'm sure entirely accidentally)
> thought-provoking question.

Michael

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to