I'm trying to translate some python code to scala code. So I'm a total noob in Python.
But why do some classes have object as a parameter but never explicitly use it? What's the reasoning for having it as a parameter in the first place?
In Python2 this declares
Table to be a new-style class (as opposed to "classic" class).
In Python3 all classes are new-style classes, so this is no longer necessary.
New style classes have a few special attributes that classic classes lack.
class Classic: pass class NewStyle(object): pass print(dir(Classic)) # ['__doc__', '__module__'] print(dir(NewStyle)) # ['__class__', '__delattr__', '__dict__', '__doc__', '__format__', '__getattribute__', '__hash__', '__init__', '__module__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__']
In Python2 it is a good idea to make all classes new-style classes. (Though a lot of classes in the standard library are still classic classes, for the sake of backward-compatibility.)
In general, in a statement such as
class Foo(Base1, Base2):
Foo is being declared as a class inheriting from base classes
object is the mother of all classes in Python. It is a new-style class, so inheriting from
Table a new-style class.