[Tutor] Composing lists from both items and other lists

2011-02-01 Thread John Simon
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?

Thanks,
John
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Composing lists from both items and other lists

2011-02-01 Thread John Simon
Andre Engels  gmail.com> writes
> Is:
>
> [start] + items + [end]
>
> lightweight enough?

Oh man, duh. I knew it was something simple. Thanks :)
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor