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

János Juhász janos.juhasz at VELUX.com
Mon Oct 1 16:51:53 CEST 2007


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,
______________________________
Janos Juhasz



More information about the Tutor mailing list