+ 1
Only magic methods can return any value, is it so?
What I am seeing till now is that only magic methods are returning values, which other methods are just editing those. Somebody clarify pls..
1 Odpowiedź
+ 2
All kinds of functions, be they free or part of a class (aka methods), can return or not return values!
It depends on if there's a return statement or not:
def f():
print('Hello')
returns nothing.
def f():
print('Hello')
return 1
returns 1.
(__init__ is a 'magic method' and is not allowed to have a return value - so you see it has nothing to do with mm or not mm.)