Re: Reference to self not passed to member function

2005-05-06 Thread Bengt Richter
On Sat, 7 May 2005 01:06:31 +0200, "Fredrik Lundh" <[EMAIL PROTECTED]> wrote: >James Stroud wrote: > >> I did this: >> >> py> class bob(object): >> ... def __init__(self,**kwargs): >> ... for fname,func in kwargs.items(): >> ... setattr(self, fname, lambda *args : func(*args)) >> ... >

Re: Reference to self not passed to member function

2005-05-06 Thread James Stroud
Thanks to both Scott and Fredrik. James On Friday 06 May 2005 04:22 pm, Scott David Daniels wrote: > James Stroud wrote: > > Hello All, > > > > I did this: > > > > py> class bob(object): > > ... def __init__(self,**kwargs): > > ... for fname,func in kwargs.items(): > > ... setattr(sel

Re: Reference to self not passed to member function

2005-05-06 Thread Scott David Daniels
James Stroud wrote: > Hello All, > > I did this: > > py> class bob(object): > ... def __init__(self,**kwargs): > ... for fname,func in kwargs.items(): > ... setattr(self, fname, lambda *args : func(*args)) > ... > py> def doit(): > ... print "wuzzup?" > ... > py> abob = bob(doit=doi

Re: Reference to self not passed to member function

2005-05-06 Thread Fredrik Lundh
James Stroud wrote: > I did this: > > py> class bob(object): > ... def __init__(self,**kwargs): > ... for fname,func in kwargs.items(): > ... setattr(self, fname, lambda *args : func(*args)) > ... > py> def doit(): > ... print "wuzzup?" > ... > py> abob = bob(doit=doit) > py> > py> a

Re: Reference to self not passed to member function

2005-05-06 Thread [EMAIL PROTECTED]
I think it is more clear to rephrase your code as: -#!/usr/bin/env python -class bob(object): -def __init__(self,**kwargs): -print kwargs -for fname,func in kwargs.items(): -setattr(self, fname, lambda *args : func(*args)) - -def doit(): -print "wuzzup?" - - -abo

Reference to self not passed to member function

2005-05-06 Thread James Stroud
Hello All, I did this: py> class bob(object): ... def __init__(self,**kwargs): ... for fname,func in kwargs.items(): ... setattr(self, fname, lambda *args : func(*args)) ... py> def doit(): ... print "wuzzup?" ... py> abob = bob(doit=doit) py> py> abob.doit() wuzzup? Much to my su