I found some very odd behaviour in Python's very basic types

Sunjay Varma varma.sunjay at gmail.com
Thu Mar 10 00:47:37 EST 2011


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.

I also have just started this very discussion (although in more words)
on Python-Forum.org. Check it out there as well:
http://python-forum.org/pythonforum/viewtopic.php?f=18&t=24542&p=113404

I know a lot of very experienced Python programmers view these mailing
lists. It would be fantastic if this could get fixed. Python would get
momentously more powerful if this feature was implemented. People
would be able to apply new methods and attributes to strings, lists,
dictionaries, sets, and all the built-in types. Improving them when
needed and allowing for extended functionality.

If you prefer to email me directly, just use this email:
haimunt(at)yahoo(dot)com

Thanks for your help! I hope we can discuss this (possible) bug. :)

-Sunjay03



More information about the Python-list mailing list