0
guide plz why the output is not "fcim"?
def f(): print('f') class C: print('c') def __init__(self): print('i') def m(self): print('m') f() C().m()
1 Answer
+ 3
I think python firstly stores each function data in its memory and when we call it , it executes.
As functions/method in oop are stored under class name. So in order to store that functions too it also go thru class and as it go thru it, it executes and print "c" first as it is not in any function/method.
(I think)