I am unable to understand why the behaviour in the below 2 examples is different. Is there a better way to achieve this?
Example 1:
class A: def __