In article <[EMAIL PROTECTED]>, Michael Spencer <[EMAIL PROTECTED]> writes: |> |> "instantiation" (i.e., calling the __new__ method) of new-style classes |> can return whatever you like, but I'm not sure how that helps.
Yes and no. While it can return any value you like, it can't act as a class declaration - and that is what I need in this context! My request in this thread was because I am trying to find a way around that restriction. All right, I am looking for a seriously advanced language feature, that doesn't exist in 99% of known languages :-) I am very much out of touch with Lisp, but there was an almighty hoo-hah over this point some 25 years back, during the design of Common Lisp. I believe that it included it, and I am pretty sure that I could do it in Haskell (which I am almost as out of touch with), but in no other language that most people will ever have heard of. But I am (again) out of touch with this area! Ideally, what I want to do is to define a class (A) in Python that has essentially no exposed methods, but which can be instantiated to produce another class (B), which can then be used exactly like a built-in class (which is what it is designed to be). Each such instantiation of (A) would be a distinct class (B), derived from (A). All of the methods of (B) would be inherited from 'hidden' methods of (A), most would be in C (the language), and few would usable directly on 'objects' of class (A). There are several ways of doing this in Python, but I can't find any that are as transparent to the user as I would really like. There is method in my madness :-) Regards, Nick Maclaren. -- http://mail.python.org/mailman/listinfo/python-list