Here's an idea I was toying with in thinking about the problem this evening.
Currently, python complains if you try to add a class member that will conflict with a slot:
>>> class C:
... __slots__="x"
... x=1
...
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: 'x' in __slots__ conflicts with class variable
What if the slots machinery were changed so that there was a warning propagated instead, and the conflicting member value(s) were saved in some appropriate place in the class namespace? Maybe something like __slot_conflicts__, or something like that.
>>> class C:
... __slots__="x"
... x=1
...
>>> C.__slot_conflicts__["x"]1
This would give the decorator the opportunity to find the stuff that was put in those fields, and sort out the class definition in an expected way.
---
Ricky.
"I've never met a Kentucky man who wasn't either thinking about going home or actually going home." - Happy Chandler