On Fri, 28 Oct 2011 00:52:40 +0200, candide <candide@free.invalid> wrote: [snip] >>>>> hasattr(42, '__dict__') >> False [snip] > > Let'have a try : > > >>> hasattr(43, '__dict__') > False > >>> > > so we have proved by induction that no integer instance has a > dictionnary attribute ;)
You left out an important step in this proof by induction. Observe: >>> n = 0 >>> hasattr(n, "__dict__") False >>> if hasattr(n, "__dict__") is False: ... hasattr(n+1, "__dict__") is False ... True There, now it's proven by induction. -- To email me, substitute nowhere->spamcop, invalid->net. -- http://mail.python.org/mailman/listinfo/python-list