[Baypiggies] Trivial OOP pattern problem

Isaac hyperneato at gmail.com
Fri Jun 15 08:37:57 CEST 2012


Nice!

On Fri, Jun 15, 2012 at 2:28 AM, Brian Palmer <bpalmer at gmail.com> wrote:
>
>
> Your initial solution seems like it'd work:
> class Wrap(object):
>   def __init__(self, ctx):
>     self.ctx = ctx
>
>   def __getattr__(self, name):
>     def myf(*args, **kwargs):
>       getattr(self.ctx, name)(*args, **kwargs)
>       return self
>     return myf
>
> There are benefits to being less dynamic, but this might be good enough.
>
> _______________________________________________
> Baypiggies mailing list
> Baypiggies at python.org
> To change your subscription options or unsubscribe:
> http://mail.python.org/mailman/listinfo/baypiggies
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/baypiggies/attachments/20120615/e03c2a97/attachment.html>


More information about the Baypiggies mailing list