Wrapper objects

redhog at takeit.se redhog at takeit.se
Fri Dec 10 18:03:01 EST 2004


>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-keyword could an object and a wrapped version of it apart.

I've thought of using a weakdict instaed, problem is, it would be a
little bit too transparent for my purpose as the only way to tell an
object and a wrapped version of it apart would be by my own functions
which would do lookups in that dict. Secondly, it would only allow for
one comment per object dopy, which would fail horribly for e.g. numbers
(there are hundreds of uses of the number 1, which all needs different
comments for the number).




More information about the Python-list mailing list