On Nov 10, 1:09 pm, "lallous" <lall...@lgwm.org> wrote: > Hello > > I have 3 questions, hope someone can help: > > 1) > How can I create an instance class in Python, currently I do: > > class empty: > pass > > Then anytime I want that class (which I treat like a dictionary): > > o = empty() > o.myattr = 1 > etc.... > > Is there is a one line syntax to instantiate an instance?
I think that you want this: class c(object): def __init__(self, **kwds): self.__dict__ = kwds x = c(a=1, b=2) print x.a, x.b -- http://mail.python.org/mailman/listinfo/python-list