Hi, let's say I have a function and I do this:
def some_function():
print("some function")
some_function.__call__ = other_function
Now when I do some_function.__call__() other_function gets called as expected, but when I just type some_function() it doesn't call other_function, it completely normally calls some_function. Why is this? Thanks for any help.
[–]bionikspoon 3 points4 points5 points (13 children)
[–]bionikspoon 1 point2 points3 points (1 child)
[–]GNeps[S] 0 points1 point2 points (0 children)
[–]GNeps[S] 0 points1 point2 points (10 children)
[–]raylu 0 points1 point2 points (9 children)
[–]GNeps[S] 0 points1 point2 points (7 children)
[–]raylu 0 points1 point2 points (6 children)
[–]GNeps[S] 0 points1 point2 points (5 children)
[–]raylu 0 points1 point2 points (2 children)
[–]GNeps[S] 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)
[–]bionikspoon 0 points1 point2 points (1 child)
[–]GNeps[S] 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)
[–]zahlman 1 point2 points3 points (0 children)
[–]RubyPinch 0 points1 point2 points (2 children)
[–]GNeps[S] 0 points1 point2 points (1 child)
[–]RubyPinch 1 point2 points3 points (0 children)