> It's also a bad idea for initializers that aren't immutable, because > the initial values are shared between all instances (another example > of the "aliasing" problem, also known from default argument values). Right. I once knew that and had forgotten. > > Though I think of __slots__ as a way to make lighter weight instances, > > constraining instance variables is also one of its functions. > > Not true. That is at best an unintended side effect of slots. And > there's nothing against having __slots__ include __dict__, so your > instance has a __dict__ as well as slots. That's something I never knew but wish I had known (and I *have* read the source). Live and learn. Raymond
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4