I have a difficult problem in the game I'm working on. I use Pygame to develop it. I turned out to be one of those developers who never use the __dict__default object variable ; I always define __slots__to clarify the variables that an object can have (I have a class method that reads slots to determine the variables needed from the configuration file).
Anyway, I just realized that these efforts do not work in some of my classes; they still have a variable __dict__and may have arbitrary attributes assigned, although they explicitly define them __slots__. I think this is because they inherit from pygame.sprite.Sprite, which has __dict__. If so, how can I suppress the creation of this dictation? (I should have explicitly indicated __slots__). Or could I be wrong in the reason? Thank you for understanding; itβs hard to find information about this particular problem through search queries.
source
share