Brian Allen Vanderburg II wrote:
Is list creation really more costly than above?
Probably not. I wrote a small test program using a list several levels
deep, each list containing 5 sublists at each level and finally just a
list of numbers. Flattening 1000 times took about 3.9 seconds for the
one creating a list at each level, and 3.2 for the one not creating the
list at each level.
Hmm, I'm surprised by even that! Apparently list creation is more
expensive than I thought - it seems somewhat more expensive than the
cost of interpreting bytecode for "if var is None". Either list creation
is somewhat costly, or "if var is None" is really cheap.
Regards,
mk
--
http://mail.python.org/mailman/listinfo/python-list