On Mar 9, 10:47 pm, Sunjay Varma <varma.sun...@gmail.com> 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. For some reason though, > even though the interpreter says that str == type("hello"), > overwriting the str name changes nothing in the literal. Is this a > bug? I'm not sure. > > -Sunjay03
This is neither a bug nor a feature, it's simply the way that Python works. Literals are handled during compilation; the built-in types are run-time objects. Python is not a language where a script can change compile-time behavior. Doing that would make it a very different language, and would put it into a very different niche in the language ecology. John Roth -- http://mail.python.org/mailman/listinfo/python-list