There are a number of threads on SO dealing with a similar question, e.g.
How to create a unique and incremental ID in a Python Class
Auto-incrementing IDs for Class Instances
How do you create an incremental ID in a Python Class
The solution in each of these threads is to use itertools.count() to assign a unique ID to a class attribute.
My issue with this solution is that this guarantees a unique ID within a single interpreter session. But what about if you want to persist/serialize the instances you created and then use them in another interpreter session? The itertools.count() would start from zero again so you may create instances with the same ID.
The only thing that occurs to me is to bind the auto-increment to some time stamp (e.g. in milliseconds or for my application even in seconds as the instances would be created slowly). It is still not guaranteed to be unique on different environments but, at least, in the same virtual environment it should be unique.
This is a question which seems a bit rhetorical - but I am welcoming opinions on this as well as suggestions about possible alternatives