[Baypiggies] Trivial OOP pattern problem

Ian Zimmerman itz at buug.org
Fri Jun 15 17:44:39 CEST 2012


David> Sorry for all the messages, but what I was doing was overkill.
David> After re-reading Brian's message I suppose you could just do this:

 > def __getattr__(self, name):
 > def myf(*args, **kwargs):
 > to_return = getattr(self.ctx, name)(*args, **kwargs)
 > if to_return is None:
 > to_return = self
 > return to_return
 > return myf

I'll probably use this, or a close variant of it.  Thanks to all for the ideas!

-- 
Ian Zimmerman
gpg public key: 1024D/C6FF61AD
fingerprint: 66DC D68F 5C1B 4D71 2EE5  BD03 8A00 786C C6FF 61AD
http://www.gravatar.com/avatar/c66875cda51109f76c6312f4d4743d1e.png
Rule 420: All persons more than eight miles high to leave the court.


More information about the Baypiggies mailing list