On 19 Nov., 00:02, MonkeeSage <[EMAIL PROTECTED]> wrote: > Ps. Just for kicks, here is a simple ruby 1.8 mock-up of the proposal > (sorry for using ruby, but I don't know enough C to start hacking the > CPython backend; I think that a higher-level example is conceptually > clearer anyhow).
No need to excuse. I think Ruby provides a nice context for discussing the semantics of top level "open classes". But I think those are entirely different than your contextual bindings. Note I find your proposal somewhat confusing since I expect that an attribute is "owned" by an object and is not an arbitrary contextual property. Regarding open classes in Python, what about "extension classes"? class +object: def len(self): return self.__len__() This either adds the len method to the namespace of object or it creates a new namespace which is associated with the namespace of object s.t. each object can lookup attributes in this namespace when default lookup fails. I'm not entirely sure about scope. I think the lifetime of an extension class shall be determined by the lifetime of the extended class and not by the scope in which the extension class is defined. What do you think? Kay PS. you can use EasyExtend when you want to provide a language extension without hacking the CPython runtime. EE was made for such kinds of experiments. -- http://mail.python.org/mailman/listinfo/python-list