On Wed, 17 Oct 2007 15:01:09 -0700, kiilerix wrote: > On Oct 17, 9:11 pm, "Chris Mellon" <[EMAIL PROTECTED]> wrote: >> On 10/17/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: >> > >>> o = object() >> > >>> o.foo = 7 >> >> What makes you think it can't be instantiated directly? You just did >> it. It's not, however, suitable for use as an arbitrary thing to stick >> attributes on. >> >> Which is a little sad, but a necessary requirement for things like >> int() and str() to be small and fast. > > So it's an optimization with side effects, giving a special case where > the simple and otherwise "right" way to do it doesn't work? Too bad :- > ( > > Ok; I'll continue to create dummy classes inheriting from object. And > hope that one day it will be simpler.
I'm using the following "dummy" class with a little extra functionality: def Bunch(object): def __init__(self, **kwargs): self.__dict__.update(kwargs) person = Bunch(name='Eric', age=42) print person.name point = Bunch(x=4711, y=23) Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list