Tim Peters wrote:

> More idiomatic as
> 
>    if len(list) > 0:
> 
> and even more so as plain
> 
>    if list:
> 
>>    print list[0],
>>    for element in list[1:]:
>>      print ',', element,
> 
> 
> Do you really want a space before and after each inter-element comma?

No, but it was only an example. I usually go for string concatenation.

> An often-overlooked alternative to playing with ",".join() is:
> 
>    print str(list)[1:-1]

That's funny! Not that I like it more that the join solution, but funny 
nevertheless.

Thank you,
Ernesto
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to