On Tue, Feb 1, 2011 at 9:40 PM, John Simon <[email protected]> wrote:
> I'm looking for a way to flatten lists inside a list literal, kind of like
> this:
>
>>>> start = '('
>>>> end = ')'
>>>> items = ['abc', '+', 'def']
>>>> [start, *items, end]
> ['(', 'abc', '+', 'def', ')']
> Of course, the star doesn't work there. Is there any easy,
> syntactically-lightweight way to get that output?

Is:

[start] + items + [end]

lightweight enough?


-- 
AndrĂ© Engels, [email protected]
_______________________________________________
Tutor maillist  -  [email protected]
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to