Answer the question
In order to leave comments, you need to log in
How to use shared data for multiple objects?
It is required to create several objects of the same type, each of which has a certain field, which must be different for all objects. The problem is that these objects are created at different times and from different parts of the program. How to track the uniqueness of such fields in objects? If you make a static array in the class itself, and add a unique field of already existing objects to it? Or is it better to keep a separate list of these fields, but then this list will have to be carried everywhere with you.
Answer the question
In order to leave comments, you need to log in
An array for some reason - usually an auto-increment field is dispensed with. Declare it as a classproperty and increment it in __init__()
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question