Flattening lists

mk mrkafk at gmail.com
Thu Feb 5 16:24:53 CET 2009


Baolong zhen wrote:
> less list creation.

At the cost of doing this at each 'flatten' call:

if res is None:
    res = []

The number of situations of executing above code is the same as the 
number of list creations (once for each 'flatten' call, obviously).

Is list creation really more costly than above?

Regards,
mk




More information about the Python-list mailing list