3 odpowiedzi
+ 9
Sanjay Kamath , here is link to an explanation about operator overloading with various samples:
https://www.geeksforgeeks.org/operator-overloading-in-JUMP_LINK__&&__python__&&__JUMP_LINK/
+ 4
Any example of the use case?
+ 1
Python supports operator overloading. So you can use + operator in print function (I believe you meant print function). For example:
>>print( "Hello " + "world!" )
Hello world!
This works because python has operator overloading. Here two strings are concatenated using the string class's internal __add__( ) method which is how the operator overloading is implemented.