In 2.x, the default metaclass is actually ‘classobj’, which implements old-style class semantics. You have to either inherit from object, invoke type explicitly or set your metaclass to type in order to get a full fledged new style class.

The process to create a class

but what Python does under the hood is the following:

When it sees a class definition, Python executes it to collect the attributes (including methods) into a dictionary.

When the class definition is over, Python determines the metaclass of the class. Let’s call it Meta. if the class or any bases has a metaclass defined, python use it, otherwise Meta = type.

Eventually, Python executes Meta(name, bases, dct), where:

Meta is the metaclass, so this invocation is instantiating it.

name is the name of the newly created class

bases is a tuple of the class’s base classes

dct maps attribute names to objects, listing all of the class’s attributes

funcking complicated

for new and init in regular class

Use new when you need to control the creation of a new instance. Use init when you need to control initialization of a new instance.

new is the first step of instance creation. It's called first, and is responsible for returning a new instance of your class. In contrast, init doesn't return anything; it's only responsible for initializing the instance after it's been created.

In general, you shouldn't need to override new unless you're subclassing an immutable type like str, int, unicode or tuple.