10 Oct 2009, 4:34pm
Python:
by

leave a comment

Dynamic Attributes in Python Model Class

class Bar():
    def __init__(self, **args):
        for key in args:
            self.__dict__[key] = args[key]

b = Bar(fullname="Monty Python", email="me@monthpython.org")
b.fullname #=> Monty Python
b.email #=>me@montypython.org