Re: Wrapper objects

2004-12-10 Thread redhog
Bengt Richter wrote: > On 9 Dec 2004 06:11:41 -0800, [EMAIL PROTECTED] (Egil M?ller) wrote: > > >Is there any way to create transparent wrapper objects in Python? > > > >I thought implementing __getattribute__ on either the wrapper class or > >its metaclass would do the trick, but it does not work

Re: Wrapper objects

2004-12-10 Thread redhog
Ah, thanks. I didn't think of the possibility of creating a list of methods that needed wrapping, and wrapping them uppon creation of the wrapper object. Mainly I think, becaus it seems to me as such an uggly workaround for a misdesign in Python. Also, if the wrapped object gets some extra methods/

Re: Wrapper objects

2004-12-10 Thread redhog
As to what I want to use this for, I today have a huge program in which several objects are wrapped up with comments (made up by some DOMish structre) which are displayed to the user at various times. For example, a list of users may be represented as as comment "List of users" and a python list of

Re: Wrapper objects

2004-12-10 Thread redhog
>Well, that could be a feature, depending on what your use case is. >Or you could make a method for adding methods, I suppose. >A perfectly transparent wrap of obj would be to do nothing ;-) >What do you actually want to do? Actually, the very best would if only type(), isinstance() and the is-key