> Either list creation is somewhat
> costly, or "if var is None" is really cheap.

"if x is y" is extremely cheap, I believe. Unlike most comparisons
which are (relatively) expensive, that one is just comparing simple
object address. You can't override "is" so there's a whole series of
checks that don't have to get done. You don't have to go through the
richcompare machinery, check if there's a __ne__, etc, etc.

--S
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to