April end-month report
2 weeks ago
A collection of articles, ideas, and rambling from a guy who wrote some software that one time.
__slots__, you might have noticed that it comes with a pleasant side-effect: it makes it impossible to assign extra, garbage attributes to your objects. While normally not a serious problem, objects with extra, unintentional crud stuck to them can make object databases hell to work with as you struggle to figure out where it came from or why it is in your database but not in memory. Therefore, this semantic feature is handy in addition to reducing the memory footprint of objects if you have large numbers of them lying around.
__slots__because you have no control over what slots are used from your base classes.
isinstance- you weren't using
isinstanceanyway, right? - it does do the sane thing that you would expect a cooperative
__slots__implementation to do; you can subclass from random other classes (provided that you properly specify all their attributes as slots on your object) and other SlotMachines, and even other objects that define __slots__, without giving up the explicit specification of attributes or the ability to inherit from things.
(As any ADD sufferer will testify, piles are the enemy. When one's cohabitant has an entire house and 3 whole lifetimes worth of stuff to pile up, the piles can set you up for a crushing and continuous defeat, which is definitely no good for one's mental health, creating a feedback loop where one is discouraged or even afraid to organize things.)Kim defeated even the piles which we had made an uneasy truce with, the ones which we had actively tried to clean up before and had been resigned to treat as simply a messy storage solution rather than a problem. With the piles trapped and cornered, the floors are walkable and the surfaces usable. Who knew that using a vacuum cleaner could be so much fun?