class RegistrationForm(self,FlaskForm): NameError: name 'self' is not defined code example

Example 1: Exception has occurred: NameError name 'self' is not defined

"""
Default argument values are evaluated at function define-time,
but self is an argument only available at function call time.
This arguments in the argument list cannot refer each other.
It's a common pattern to default an argument to None and add
a test for that in code:
"""
def p(self, b=None):
    if b is None:
        b = self.a
    print b

Example 2: Exception has occurred: NameError name 'self' is not defined

def function():
  	print(self.result)
# Causes an error -> NameError: name 'self' is not defined

def function(self):
  	print(self.result)