About 39,100 results
Open links in new tab
  1. How do I use method overloading in Python? - Stack Overflow

    Apr 18, 2012 · In Python, think of methods as a special set of "attributes", and there can only be one "attribute" (and thus one method) of a given name for an object. The last method …

  2. python - How to overload __init__ method based on argument …

    I want to be able to initialize the class with, for example, a filename (which contains data to initialize the list) or with an actual list. What's your technique for doing this? Do you just check …

  3. Overloaded functions in Python - Stack Overflow

    @Val I'm saying that between optional arguments and dynamic types the way you have them in Python, you don't need Java style method overloading to achieve polymorphism.

  4. class - Python function overloading - Stack Overflow

    Jan 1, 2016 · Python does support "method overloading" as you present it. In fact, what you just describe is trivial to implement in Python, in so many different ways, but I would go with:

  5. Method overloading for different argument type in python

    Aug 17, 2014 · Of course, python can't do this, because it has dynamic typing. When I searched for how to mimick method overloading, all answers just said "You don't want to do that in python".

  6. method overloading in python - Stack Overflow

    Mar 16, 2012 · 6 Usually you can only define one method in a class with a given name. In your example the 2 argument first () method overwrote the 1 argument first (). If you want two …

  7. Decorator for overloading in Python - Stack Overflow

    Dec 28, 2011 · So the logical way to implement overloading in Python is to implement a wrapper that uses both the declared name and the parameter types to resolve the function. Here's a …

  8. How to do function overloading in Python? - Stack Overflow

    Dec 1, 2022 · There's no overloading in Python. You could fiddle something together with decorators but in general: if you learn a new language use it as it is intended to use.

  9. python - Overloading Addition, Subtraction, and Multiplication ...

    How do you go about overloading the addition, subtraction, and multiplication operator so we can add, subtract, and multiply two vectors of different or identical sizes? For example, if the vectors...

  10. Overriding a static method in python - Stack Overflow

    In the form that you are using there, you are explicitly specifying what class's static method_two to call. If method_three was a classmethod, and you called cls.method_two, you would get the …