-2

I have a class that does nothing:

class nothing():
    pass

when I print the type of my class:

p1 = nothing()
print(type(p1))

I get:

<class '__main__.nothing'>

What is the meaning of '__main__'?

coder
  • 151
  • 1
  • 13
  • 2
    https://stackoverflow.com/questions/54018653/what-does-main-mean-in-the-output-of-type that is a very common question. Make sure you do some research first before posting questions. – Schach21 Jul 20 '21 at 03:18

1 Answers1

0

I found a definition of __main__ https://docs.python.org/3/library/__main\__.html

'__main__' is the name of the scope in which top-level code executes. A module’s __name__ is set equal to '__main__' when read from standard input, a script, or from an interactive prompt.

so basically it means you made you defined that class in the file that you ran with python.

coder
  • 151
  • 1
  • 13