On 3/10/2011 12:47 AM, Sunjay Varma wrote:
For some reason, sub-classing and overwriting a built-in type does not
change the behavior of the literal. Logically speaking, overwriting a
name, such as str, should delete the basic str type, and replace it
with the new class or object put in its place.
No, that is fundamentally wrong. Rebinding a name in a particular
namespace only deletes the association in that namespace.
Built-in classes are just that. You cannot get rid of them. They are
used in the operation of the interpreter.
For some reason though,
even though the interpreter says that str == type("hello"),
overwriting the str name changes nothing in the literal.
Right. By design. String and number literals are always string and
number literals.
Is this a bug?
No.
--
Terry Jan Reedy
--
http://mail.python.org/mailman/listinfo/python-list