OT (Kinda) Question

Dj Gilcrease digitalxero at gmail.com
Fri Feb 2 13:48:27 PST 2007


I have a class that accepts *args and **kwargs as it's initialization
parameters and I want to be able to set a class "property" for each of
the keywords,  is there a way to do this?


#### Sudo-code Start ####
class Sample:
    def __init__(self, *args, **kwargs):
        for property in kwargs.keys():
            self.{property} = kwargs[property]


data = Sample(test='test1', more='more testing', int=7)

print data.test
#### Sudo-code End ####




More information about the wxpython-users mailing list