[Python-ideas] List Comprehensions
Chris Angelico
rosuav at gmail.com
Wed Feb 3 04:05:30 EST 2016
On Wed, Feb 3, 2016 at 8:01 PM, Alexander Walters
<tritium-list at sdamon.com> wrote:
> That is working exactly as expected. You iterate over a tuple of a list
> (the range), and an int (100).
I have to say, though, I was a little confused at first, because I'm
used to range objects not being lists. And trying it showed that the
syntax has been tightened up somewhere:
>>> [x for x in range(10),100]
File "<stdin>", line 1
[x for x in range(10),100]
^
SyntaxError: invalid syntax
But in Python 2.7, it behaves as the OP describes. I wonder, does
python-ideas need a bit more clarification somewhere that this is
(almost) exclusively for the discussion of Python 3, as that's where
new ideas can actually be implemented?
ChrisA
More information about the Python-ideas
mailing list