1"""
2Default argument values are evaluated at function define-time,
3but self is an argument only available at function call time.
4This arguments in the argument list cannot refer each other.
5It's a common pattern to default an argument to None and add
6a test for that in code:
7"""
8def p(self, b=None):
9 if b is None:
10 b = self.a
11 print b
1def function():
2 print(self.result)
3# Causes an error -> NameError: name 'self' is not defined
4
5def function(self):
6 print(self.result)