> I feel like I should be honest about something else - I'm always a
> little bit confused by the ordering for comprehensions involving
> multiple clauses. For me, it's the fact that:
> [[a for a in b] for b in ['uvw', 'xyz']] == [['u', 'v', 'w'], ['x', 'y',
> 'z']]
> which makes me want to write:
On 17 October 2016 at 21:22, Random832 wrote:
>
> No, it's not.
>
> For a more concrete example:
>
> [*range(x) for x in range(4)]
> [*(),*(0,),*(0,1),*(0,1,2)]
> [0, 0, 1, 0, 1, 2]
>
> There is simply no way to get there by using flatten(range(4)).
the equivalent flatten for that is:
flatten(r
On 18 October 2016 at 07:31, Nick Coghlan wrote:
>
> Forcing ourselves to come up with a name for the series of values
> produced by the outer iteration then makes that name available as
> documentation of our intent for future readers of the code.
This is a key point, that is frequently missed w
On Tue, Oct 18, 2016, at 04:01, Daniel Moisset wrote:
> I see some mention that flatten does not cover all cases; but correct
> me if I'm wrong with this statement:
>
> Any case of [* for in ] could be replaced with
> flatten( for in ). Where flatten is defined as
>
> def flatten(it):
> ret
On 18/10/2016 07:40, Greg Ewing wrote:
Random832 wrote:
For me, it's the fact that:
[[a for a in b] for b in ['uvw', 'xyz']] == [['u', 'v', 'w'], ['x', 'y',
'z']]
which makes me want to write:
[a for a in b for b in ['uvw', 'xyz']]
You're not alone! Lately I've been becoming convinced that
t
Hi all,
I'd like to propose that Python's iterator protocol be enhanced to add
a first-class notion of completion / cleanup.
This is mostly motivated by thinking about the issues around async
generators and cleanup. Unfortunately even though PEP 525 was accepted
I found myself unable to stop pond