I'm new to python and have a simple question: Is it possible to statically overload a member fuction? Like for example so:
class A:
    text=""
    def __init__(self, text):
        self.text = text
    def print(self):
        print (self.text)
    @staticmethod
    def print():
        print ("static")
a = A("test") 
a.print()
In this case "static" is printed out. Is it impossible to call the member function if a static function with the same name exists? And if not, who do I call it?
You aren't overloading the method; you are replacing it with the static method. You'll have to pick a different name for the static method.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With