To answer your question, __init__ is called as a call to Flask() . Your initial call is to run an instance of the Flask class, and __init__ is the function that does the tuning.
To solve your immediate problem: You need to pass only one argument. The error message is misleading.
This is not true, but it is a function that you are not calling. The @codegeek example shows you what the "first" argument is. This is self . But it came from inside the class when class.__init__ is called as a call to Flask() . You do not see self , except implicitly - this is the argument (1 given) in your trace when you thought you were passing null arguments.
It is important to note that this is not unique to this case - you will see the same in very simple examples, for example:
class Example: def __init__(self, one): self.one = one ex = Example()
This will give:
TypeError: __init__() takes exactly 2 arguments (1 given)
The value, Example() calls __init__ , which wants me and one, and it only got me.
(From the question, however, I strongly recommend that you read something like http://pythoncentral.io/introduction-to-python-classes/ or another introduction to python classes. Classes are a fundamental element of the language and their initialization is the main part of them functionality.)
source share