Steven D'Aprano <[EMAIL PROTECTED]> wrote: > But if you wanted to do extra work unnecessarily, a less unnecessary > amount of extra work would be: > > if type(x) == type(None): ...
Of course, like the original poster's proposal, this CAN be faked out (while the 'is' test cannot, one more weird reason why it's better): >>> class metaWeird(type): ... def __eq__(self, other): return True ... >>> class Weird: __metaclass__ = metaWeird ... >>> x = Weird() >>> type(x) == type(None) True (warning to all innocent bystanders: don't try this at home, kids!-) Alex -- http://mail.python.org/mailman/listinfo/python-list