<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">For a more concrete example:<br>
<br>
[*range(x) for x in range(4)]<br>
[*(),*(0,),*(0,1),*(0,1,2)]<br>
[0, 0, 1, 0, 1, 2]<br></blockquote><div><br></div><div>As Paul or someone pointed out, that's a fairly odd thing to do. It's the first time that use case has been mentioned in this thread. It's true you've managed to construct something that isn't done by flatten(). I would have had to think a while to see what you meant by the original if you haven't provided the intermediate interpretations.</div><div><br></div><div>Of course, it's *really simple* to spell that in a natural way with existing syntax that isn't confusing like yours:</div><div><br></div><div> [x for end in range(4) for x in range(end)]<br></div><div><br></div><div>There is no possible way to construct something that would use the proposed syntax that can't be expressed more naturally with a nested loop... because it's just confusing syntax sugar for exactly that.</div><div><br></div><div>Your example looks like some sort of interview quiz question to see if someone knows obscure and unusual syntax.</div></div></div>
</div>