Search code examples
pythonterminology

What's implicit method call and explicit method call?


I read about those terms in my python text book. I can't figure out the meaning by looking up the literal meaning of them. Could someone explain that to me or provide me some reference?

--update the context of the term

i) (­42).__abs__() # Need parentheses to avoid confusing ... # ... method call '.' with decimal point
j) (42).__mul__(2) # Even multiplication is a method call
k) name.swapcase()
l) name.title().swapcase() # name.title() is an object so ... m) name.upper().find('TOM') # ... we can “cascade” method calls.

Hopefully you now realise that most of the operations you've done so far in this course have actually been provided by implicitly calling methods of the objects (data items) that you've been working with. Indeed, all operators ('+', '*' etc) are just syntactic shortcuts for method calls, but only some of the built-in functions correspond to methods.


Solution

  • Well, I don't know the context of these terminologies in your book but I found implicit-vs-explicit-programming. It first talked about explicit programming and implicit programming then implicit method call and explicit member call. Not sure whether it can help. Maybe you can give us more details.

    EDIT:

    I suppose what it means is that when you use 3+2 or 3*2 it seems you you don't explicitly call any method but in fact you called because the way they are implemented is calling the (3).__add__(2) or (3).__mul__(2). So you are calling these methods implicitly.