Django model instances primary keys do not reset to 1 after all instances are deleted

I wouldn’t call it an issue. This is default behaviour for many database systems. Basically, the auto-increment counter for a table is persistent, and deleting entries does not affect the counter. The actual value of the primary key does not affect performance or anything, it only has aesthetic value (if you ever reach the 2 … Read more

Why can’t you add attributes to object in python? [duplicate]

Notice that an object instance has no __dict__ attribute: >>> dir(object()) [‘__class__’, ‘__delattr__’, ‘__doc__’, ‘__getattribute__’, ‘__hash__’, ‘__init__’, ‘__new__’, ‘__reduce__’, ‘__reduce_ex__’, ‘__repr__’, ‘__setattr__’, ‘__str__’] An example to illustrate this behavior in a derived class: >>> class Foo(object): … __slots__ = {} … >>> f = Foo() >>> f.bar = 42 Traceback (most recent call last): File … Read more