It all depends on what you call the "name" ...
>>> class Foo(object):
... pass
...
>>> _Foo = Foo
>>> def Foo():
... return _Foo()
...
>>> f = Foo()
>>> print(Foo)
<function Foo at 0x7f74a5fec8c0>
>>> print(type(f))
<class '__main__.Foo'>
>>>
As you can see, here you have a function that displays like Foo
and having it __name__
== "Foo", and a class that is open as _Foo
, but having __name__
== "Foo".
: (= > ), . , .__name__
.