Closed p-hofmann closed 7 years ago
We can do it using singleton metaclass and class manager. The idea is to return only a new instance for new blocks (new IDs) and return the existing instance if the ID is already used (like the logger class in the logging module).
An example of a working implementation (based on my previous work, compatible with python 2 and 3) : example.zip
I like that solution! I will play around with it when I find the time.
A SmdBlock object is made for every block. Storing the integer representing a block and using a SmdBlock only when needed would save a lot of space.