Quoting Greg Stein <gstein@lyra.org>:
> On Mon, Oct 14, 2002 at 02:41:34AM -0500, brane@tigris.org wrote:
> >...
> > +++ trunk/subversion/tests/clients/cmdline/svntest/testcase.py Mon Oct
> 14 02:41:33 2002
> > @@ -30,9 +30,11 @@
> >
> > def __init__(self, func):
> > if isinstance(func, _Predicate):
> > - self.func = func.func
> > - self.cond = func.cond
> > - self.text = func.text
> > + # Whee, this is better than blessing objects in Perl!
> > + # For the unenlightened: What we're doing here is adopting
> the
> > + # identity *and class* of 'func'
> > + self.__dict__ = func.__dict__
> > + self.__class__ = func.__class__
>
> Euh... are you sure that is doable in Python 2.0? So far, we've said the
> test suite only requires 2.0. I've a sneaky feeling the above code may
> require 2.1 or 2.2.
I tested this with 2.0, and it works for me. It is quite a terrific hack,
though. It would be nice if there was a module that could do stuff like that.
Maybe the shallow/deep copy thingie would work, but after thinking this up I had
no energy left to try it. :-)
Brane
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Mon Oct 14 15:09:57 2002