On 11/17/2014 03:38 PM, Dan Stromberg wrote:
>
> I'm inclined to say that list comprehensions and generator expressions
> should be different. I don't really think they should be identical,
> one being eager and one being lazy. Why let the implementation detail
> of one impact the other?
It's n
On Mon, Nov 17, 2014 at 3:30 PM, Steven D'Aprano
wrote:
>> The following list comprehension and generator expression are almost, but
>> not quite, the same:
>>
>> [expr for x in iterable]
>>
>> list(expr for x in iterable)
>>
>>
>> The difference is in the handling of StopIteration raised inside t
Steven D'Aprano wrote:
> The following list comprehension and generator expression are almost, but
> not quite, the same:
>
> [expr for x in iterable]
>
> list(expr for x in iterable)
>
>
> The difference is in the handling of StopIteration raised inside the expr.
[...]
Thanks to Roy and Wol
On 08.11.2014 22:31, Wolfgang Maier wrote:
On 08.11.2014 02:50, Steven D'Aprano wrote:
The following list comprehension and generator expression are almost, but
not quite, the same:
[expr for x in iterable]
list(expr for x in iterable)
The difference is in the handling of StopIteration raise
On 08.11.2014 02:50, Steven D'Aprano wrote:
The following list comprehension and generator expression are almost, but
not quite, the same:
[expr for x in iterable]
list(expr for x in iterable)
The difference is in the handling of StopIteration raised inside the expr.
Generator expressions con
In article <545d76fe$0$12980$c3e8da3$54964...@news.astraweb.com>,
Steven D'Aprano wrote:
> The following list comprehension and generator expression are almost, but
> not quite, the same:
>
> [expr for x in iterable]
>
> list(expr for x in iterable)
>
>
> The difference is in the handling of
The following list comprehension and generator expression are almost, but
not quite, the same:
[expr for x in iterable]
list(expr for x in iterable)
The difference is in the handling of StopIteration raised inside the expr.
Generator expressions consume them and halt, while comprehensions allow