append on lists
Grant Edwards
grante at visi.com
Tue Sep 16 15:49:48 CEST 2008
On 2008-09-16, Hrvoje Niksic <hniksic at xemacs.org> wrote:
> Duncan Booth <duncan.booth at invalid.invalid> writes:
>
>> The only relatively common use I can think of where you might want to call
>> a method directly on a literal is to produce a list of strings while being
>> lazy about the typing:
>
> By far the most common is probably 'sep'.join(iterable).
It's also somewhat common to index into a literal:
['one','two','three'][n]
{1:'one', 2:'two', 7:'seven'}[n]
--
Grant Edwards grante Yow! I was born in a
at Hostess Cupcake factory
visi.com before the sexual
revolution!
More information about the Python-list
mailing list