English

Is function overloading supported by Python? Give reasons.

Advertisements
Advertisements

Question

Is function overloading supported by Python? Give reasons.

Give Reasons
Advertisements

Solution

No. Python does not support traditional function overloading based on different parameter lists.

  • A function name can refer to only one function definition at a time.
  • If the same function name is defined again, the latest definition overwrites the earlier one.
  • Similar behaviour can be achieved in Python using default arguments, variable-length arguments (*args), or type checking.
shaalaa.com
  Is there an error in this question or solution?
Chapter 2: Concept of Object Oriented Programming - EXCERCISE [Page 37]

APPEARS IN

CBSE Computer Science with Python [English] Class 12
Chapter 2 Concept of Object Oriented Programming
EXCERCISE | Q 11. | Page 37
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×