Skip to main content
added 149 characters in body
Source Link
noɥʇʎԀʎzɐɹƆ
  • 10.7k
  • 3
  • 51
  • 67

The tl;dr version

The type(obj) function gets you the type of an object.

The type() of a class is its metaclass.

To use a metaclass:

class Foo(object):
    __metaclass__ = MyMetaClass

type is its own metaclass. The class of a class is a metaclass-- the body of a class is the arguments passed to the metaclass that is used to construct the class.

Here you can read about how to use metaclasses to customize class construction.

The tl;dr version

The type(obj) function gets you the type of an object.

The type() of a class is its metaclass.

To use a metaclass:

class Foo(object):
    __metaclass__ = MyMetaClass

type is its own metaclass. The class of a class is a metaclass-- the body of a class is the arguments passed to the metaclass that is used to construct the class.

The tl;dr version

The type(obj) function gets you the type of an object.

The type() of a class is its metaclass.

To use a metaclass:

class Foo(object):
    __metaclass__ = MyMetaClass

type is its own metaclass. The class of a class is a metaclass-- the body of a class is the arguments passed to the metaclass that is used to construct the class.

Here you can read about how to use metaclasses to customize class construction.

added 168 characters in body
Source Link
noɥʇʎԀʎzɐɹƆ
  • 10.7k
  • 3
  • 51
  • 67

The tl;dr version

The type(obj) function gets you the type of an object.

The type() of a class is its metaclass.

To use a metaclass:

class Foo(object):
    __metaclass__ = MyMetaClass

type is its own metaclass. The class of a class is a metaclass-- the body of a class is the arguments passed to the metaclass that is used to construct the class.

The tl;dr version

The type(obj) function gets you the type of an object.

The type() of a class is its metaclass.

To use a metaclass:

class Foo(object):
    __metaclass__ = MyMetaClass

The tl;dr version

The type(obj) function gets you the type of an object.

The type() of a class is its metaclass.

To use a metaclass:

class Foo(object):
    __metaclass__ = MyMetaClass

type is its own metaclass. The class of a class is a metaclass-- the body of a class is the arguments passed to the metaclass that is used to construct the class.

deleted 3 characters in body
Source Link
noɥʇʎԀʎzɐɹƆ
  • 10.7k
  • 3
  • 51
  • 67

The tl;dr version

The type(obj) function gets you the type of an object.

The type() of a class is its metaclass.

To defineuse a metaclass:

class Foo(object):
    __metaclass__ = MyMetaClass

The tl;dr version

The type(obj) function gets you the type of an object.

The type() of a class is its metaclass.

To define a metaclass:

class Foo(object):
    __metaclass__ = MyMetaClass

The tl;dr version

The type(obj) function gets you the type of an object.

The type() of a class is its metaclass.

To use a metaclass:

class Foo(object):
    __metaclass__ = MyMetaClass
it's-->its
Source Link
user2314737
  • 29.5k
  • 20
  • 108
  • 124
Loading
Source Link
noɥʇʎԀʎzɐɹƆ
  • 10.7k
  • 3
  • 51
  • 67
Loading