![](https://secure.gravatar.com/avatar/176220408ba450411279916772c36066.jpg?s=120&d=mm&r=g)
On Wed, Feb 17, 2021 at 9:11 PM Sven R. Kunze <srkunze@mail.de> wrote:
Still think that "object()" should be writable since this seems like an arbitrary restriction
...
But I guess there's been discussion around this already.
... but changing object would be problematic.
Well, yes, due to backward compatibility -- though how much code is counting on not being able to add attributes to an instance of object? I think someone on this thread (sorry can't find it now) said something like: if you could add attributes to object(), then you'd be able to add attributes to subclasses of object. -- but you can already: Isn't every class a subclass of object? class C: pass C.this = "something" c = C() c.that = "something else" It seems the difference is that both a new class and class instances get a __dict__. But given that all classes derive from object, and object is of type type, and classes are of type type -- I still have no idea why we can't add things to an instance of object. I suppose adding stuff to the object class itself would be very weird -- as that would mess with ALL classes. But adding to an instance of object? why not? -Chris B -- Christopher Barker, PhD (Chris) Python Language Consulting - Teaching - Scientific Software Development - Desktop GUI and Web Development - wxPython, numpy, scipy, Cython