A class without an explicit extension of object (``++class ClassName(object)++``) is considered an old-style class, and ``++__slots__++`` declarations are ignored in old-style classes. Having such a declaration in an old-style class could be confusing for maintainers and lead them to make false assumptions about the class.


== Noncompliant Code Example

----
class A:
  __slots__ = ["id"]  # Noncompliant; this is ignored

  def __init__(self):
    self.id = id
    self.name = "name"  # name wasn't declared in __slots__ but there's no error

a = A()
----


== Compliant Solution

----
class A(object):  # Converting to a new-style class is the preferred method of addressing this issue
  __slots__ = ["id"]

  def __init__(self):
    self.id = id
    self.name = "name"  # "name" is not listed in __slots__, so as expected there is an error in this line

a = A()
----
or

----
class A:

  def __init__(self):
    self.id = id
    self.name = "name"

a = A()
----

