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')
>
"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
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
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
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
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
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,
_