[Python-Dev] bool does not want to be subclassed? (original) (raw)

Guido van Rossum guido at python.org
Fri Feb 13 19:03:55 EST 2004


Type objects are also singletons (e.g., type(True) returns the same object as type(False); ditto type("True") and type("False") and type("xyz"); etc).

But types are not immutable, so their semantics are different anyway. The point of the remark was to emphasize that immutable types have some leniency in their semantics regarding object identity. For mutable types the semantics regarding object identity are defined explicitly by each type or operation (some operations always return a new object, others always return the same one).

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



More information about the Python-Dev mailing list