You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
15 lines
249 B
Python
15 lines
249 B
Python
5 years ago
|
class AutoID:
|
||
|
last_id = 0
|
||
|
|
||
|
def __init__(self):
|
||
|
self.increment_id()
|
||
|
self.id = self.last_id
|
||
|
|
||
|
@classmethod
|
||
|
def increment_id(cls):
|
||
|
cls.last_id += 1
|
||
|
|
||
|
@classmethod
|
||
|
def reset_id(cls):
|
||
|
cls.last_id = 0
|