python - Is it conventional to say that functions are called and methods are invoked? -
i’m reading think python: how think computer scientist. author uses “invoke” methods , “call” functions.
is convention? and, if so, why distinction made? why functions said called, methods said invoked?
not really, maybe easier new readers make explicit distinction in order understand invocation different. @ least why suspect author might have chosen different wording each.
there doesn't seem convention dictates in reference manual python language. seem them doing choosing invoke when call made function implicit , not explicit.
for example, in callables section of the standard type hierarchy see:
[..] when instance method object called, underlying function (
__func__
) called, inserting class instance (__self__
) in front of argument list. [...]
(emphasis mine) explicit call
further down in basic customization , for __new__
can see:
called create new instance of class
cls. __new__()
static method [...]
(emphasis mine) explicit call
while couple of sentences later you'll see how invoked used because __new__
implicitly calls __init__
:
if
__new__()
not return instance ofcls
, new instance’s__init__()
method not invoked.
(emphasis mine) implicitly called
so no, no convention seems used, @ least creators of language. simple better complex, guess :-).
Comments
Post a Comment