Dale Strickland-Clark wrote: > Thanks for the answers. I am informed but I don't feel enlightened. > > It does strike me as odd that an apparently empty subclass should add extra > function to the base class. > > Not at all obvious.
Yes. As said, there is missing a __builtin__.Object object is not an "empty class", but the base builtin-type: >>> isinstance(int,object) True built-in type instances are basically read-only because if ... >>> (1).spam=1 Traceback (most recent call last): File "<interactive input>", line 1, in ? AttributeError: 'int' object has no attribute 'spam' >>> ..would work, that would be very strange. Maybe in a mud place language like Ruby, where you can jam and scribble everywhere in the system and in builtins, such things are possible. I'd propose to add something trivial like class Object(object): def __init__(self,_d={},**kwargs): kwargs.update(_d) self.__dict__=kwargs ... to Python. I use such empty (common) class since all time I can think of - and frequently. If there would be a common such Empty class in Python you'd have a lot of advantanges. From ad-hoc instances, "OO-dicts" to reliable pickling of bunches of variables etc. Robert -- http://mail.python.org/mailman/listinfo/python-list