Re: [Tutor] using **kwargs in __init__() as attributes

2007-10-01 Thread Noufal Ibrahim
János Juhász wrote: > Dear Tutors, > > I would like to make a new class instance, where > the intance attributes coming from the kwargs hash. > > class ADUser: > def __init__(self, **kwargs): > for key in kwargs.keys(): > self.key = kwargs[k] > > a = ADUser(name='papa') >

Re: [Tutor] using **kwargs in __init__() as attributes

2007-10-01 Thread Alan Gauld
"János Juhász" <[EMAIL PROTECTED]> wrote > class ADUser: >def __init__(self, **kwargs): >for key in kwargs.keys(): >self.key = kwargs[k] > > a = ADUser(name='papa') > > > It isn't working :( Try using setattr instead of self.key assignment. HTH, -- Alan Gauld Author o

Re: [Tutor] using **kwargs in __init__() as attributes

2007-10-01 Thread Kent Johnson
Dave Kuhlman wrote: > On Mon, Oct 01, 2007 at 04:51:53PM +0200, J?nos Juh?sz wrote: >> Dear Tutors, >> >> I would like to make a new class instance, where >> the intance attributes coming from the kwargs hash. >> >> class ADUser: >> def __init__(self, **kwargs): >> for key in kwargs.key

Re: [Tutor] using **kwargs in __init__() as attributes

2007-10-01 Thread Tim Golden
Dave Kuhlman wrote: > On Mon, Oct 01, 2007 at 04:51:53PM +0200, J?nos Juh?sz wrote: >> Dear Tutors, >> >> I would like to make a new class instance, where >> the intance attributes coming from the kwargs hash. >> >> class ADUser: >> def __init__(self, **kwargs): >> for key in kwargs.key

Re: [Tutor] using **kwargs in __init__() as attributes

2007-10-01 Thread Dave Kuhlman
On Mon, Oct 01, 2007 at 04:51:53PM +0200, J?nos Juh?sz wrote: > Dear Tutors, > > I would like to make a new class instance, where > the intance attributes coming from the kwargs hash. > > class ADUser: > def __init__(self, **kwargs): > for key in kwargs.keys(): > self.key

Re: [Tutor] using **kwargs in __init__() as attributes

2007-10-01 Thread Kent Johnson
János Juhász wrote: > Dear Tutors, > > I would like to make a new class instance, where > the intance attributes coming from the kwargs hash. > > class ADUser: > def __init__(self, **kwargs): > for key in kwargs.keys(): > self.key = kwargs[k] This sets the 'key' attribute

[Tutor] using **kwargs in __init__() as attributes

2007-10-01 Thread János Juhász
Dear Tutors, I would like to make a new class instance, where the intance attributes coming from the kwargs hash. class ADUser: def __init__(self, **kwargs): for key in kwargs.keys(): self.key = kwargs[k] a = ADUser(name='papa') It isn't working :( Yours sincerely, _