It's possible to use the following code to create a list:
>>> [i+1 for i in(0,1,2)]
[1, 2, 3]
Can a similar thing be done with tuples?
>>> (i+1 for i in(0,1,2)),
(<generator object <genexpr> at 0x03A53CF0>,)
I would have expected (1, 2, 3)
as the output.
I know you can do tuple(i+1 for i in(0,1,2))
, but since you can do [i+1 for i in(0,1,2)]
, I would expect a similar thing to be possible with tuples.