On Wed, Nov 27, 2013 at 1:26 AM, Chris Angelico <ros...@gmail.com> wrote: > On Wed, Nov 27, 2013 at 12:54 AM, Jonathan Slenders > <jonat...@slenders.be> wrote: >> Where do I find the PEP that describes that the following statement assigns >> a generator object to `values`? >> values = [ (yield x) for x in range(10) ] >> >> I assume it's equivalent to the following: >> values = (x for x in range(10)) > > No, it's not the same; after yielding the ten values, the first one > then _returns_ the list. It's a weird and confusing syntax to use for > such a thing, but fundamentally it's (more or less) this:
Doh, when am I going to learn to check which list something was posted on before I respond? SIGH. Sorry all. But hey. Maybe the post will have been of interest to someone. It's a fun quirk of Python. ChrisA -- https://mail.python.org/mailman/listinfo/python-list