In Python, you can just refer directly to the class attribute:
class MyObject(object):
ID = 0
def __init__(self):
self.id = MyObject.ID = MyObject.ID + 1
Demo:
>>> class MyObject(object):
... ID = 0
... def __init__(self):
... self.id = MyObject.ID = MyObject.ID + 1
...
>>> MyObject().id
1
>>> MyObject().id
2
>>> MyObject().id
3
>>> MyObject.ID
3