Duncan Booth wrote: > No, you weren't able to extend the builtin dict class nor touch any its > constructor.
Yes, sorry. Forgot the negation. > All you did was to create a subclass with its own constructor and hide the > name for the builtin dictionary type. The original type was still unchanged > as you can see since anything which constructed a dictionary without using > the name you had overwritten still got the original type. > > If you had looked at type(dict()) and type({}) after your subclassing, you > would see that they are different types. ... which prompted my question. And prompts yet another one: seems like it is not possible with Python to modify behaviour for base classes without recompiling the interpreter. Forgive me for asking what must surely have been asked already, but are there plans to implement something like that, <teasing>like Ruby</teasing>? I would not feel too safe navigating in a source where base object behaviour might have been re-defined, but it sure is a powerful way of adding behaviour to third-party code which you may not have possibility to modify. -- http://mail.python.org/mailman/listinfo/python-list