Split a list into two parts based on a filter?

Chris Angelico rosuav at gmail.com
Tue Jun 11 13:37:11 EDT 2013


On Wed, Jun 12, 2013 at 3:23 AM, rusi <rustompmody at gmail.com> wrote:
> On Jun 11, 10:05 pm, Fábio Santos <fabiosantos... at gmail.com> wrote:
>> On 11 Jun 2013 17:47, "rusi" <rustompm... at gmail.com> wrote:
>>
>> > [Of course I would prefer a 3-liner where the body of the for is
>> > indented :-) ]
>>
>> Is this an aside comprehension?
>
> Eh?

I know they always say "don't explain the joke", but I'll have a shot
at it. It's somewhat like an autopsy though - you find out why it
ticks, but in the process, you prove that it's no longer ticking...

An aside comprehension is a means of generating an aside in-line, as
an expression. In this case, Fabio believes that you were iterating
over the smiley to generate comments about three-liners, and the
square brackets delimit the comprehension just as they do in a list
comprehension.

It's another case of code syntax cropping up in English, like this
example of ternary punctuation from a C++ program...

//TODO?: blah blah blah

That doesn't translate too well into Python though.

ChrisA



More information about the Python-list mailing list