[Edu-sig] Consistency question

Guido van Rossum guido at python.org
Thu Sep 25 10:47:26 EDT 2003

> So it seems that the int type almost doesn't need an __int__ method,
> since so much power resides in the constructor.


> If I subclass int and define __int__ myself, I wonder under what
> circumstances __int__ will be invoked -- other than by invoking it
> explicitly using myobj.__int__() semantics.

Indeed, this is a gray area where you can't count on clean semantics.

--Guido van Rossum (home page: http://www.python.org/~guido/)

More information about the Edu-sig mailing list