[Tutor] Difference(s) betweenPython 3 static methods with and without @staticmethod?

Peter Otten __peter__ at web.de
Tue Aug 8 04:24:19 EDT 2017


Alan Gauld via Tutor wrote:

> classes are objects too...

Also, classes are instances. Given

>>> class Foo:
...     pass
... 
>>> foo = Foo()
>>> type(foo)
<class '__main__.Foo'>
>>> type(Foo)
<class 'type'>

what is the type of the type of the type ... of foo?
The answer is a circular definition that you cannot spell in Python itself:

>>> type(type)
<class 'type'>

The type of type is... type. Put the other way round: like ordinary classes 
type is an instance of type.



More information about the Tutor mailing list