mk <mrkafk <at> gmail.com> writes: > 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.
Creating a list requires several function calls on the C level (including the dictionary lookup for the name "list") and memory allocation, which is usually quite expensive. In contrast, the eval loop for "is None" basically uses a pointer comparison. -- http://mail.python.org/mailman/listinfo/python-list