-5

I was confused how the function self() is used in numpy could you please elobarately explain me?I searched for it in google and SO but did not get a satisfying answer

  • 1
    Which function self? Please share the code where you found that function. Perhaps, your question is very contextual and you have not provided the context. – Abdou Nov 29 '16 at 12:15
  • 1
    Possible duplicate of [What is the purpose of self?](https://stackoverflow.com/questions/2709821/what-is-the-purpose-of-self?rq=1) – Eric Nov 29 '16 at 15:05

1 Answers1

0

there isn't a self function in basic Python.

In [1072]: self()
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
<ipython-input-1072-588c94f54e14> in <module>()
----> 1 self()

NameError: name 'self' is not defined

self is commonly used in object code to refer to the object itself. But that would be a function or callable only if the object itself is one.

We can't really answer the question without seeing some of the code where you see this used.

hpaulj
  • 221,503
  • 14
  • 230
  • 353