Hi, I see the following usage of list comprehension can generate a generator. Does anybody know where this is documented? Thanks.
$ cat main.py
#!/usr/bin/env python
import sys
lines = (line.rstrip('\n') for line in sys.stdin)
print lines
lines = [line.rstrip('\n') for line in sys.stdin]
print lines
$ seq 10 | ./main.py
<generator object <genexpr> at 0x1101ecd70>
['1', '2', '3', '4', '5', '6', '7', '8', '9', '10']
--
Regards,
Peng
--
https://mail.python.org/mailman/listinfo/python-list
