About 52 results
Open links in new tab
  1. When do you use 'self' in Python? - Stack Overflow

    Oct 18, 2016 · Are you supposed to use self when referencing a member function in Python (within the same module)? More generally, I was wondering when it is required to use self, not just for methods …

  2. oop - Why do you need explicitly have the "self" argument in a Python ...

    By making the self reference explicit, you're free to refer to any object by that self reference. Also, such a way of playing with classes at runtime is harder to do in the more static languages - not that's it's …

  3. oop - What do __init__ and self do in Python? - Stack Overflow

    Jul 8, 2017 · In this case, there are some benefits to allowing this: 1) Methods are just functions that happen defined in a class, and need to be callable either as bound methods with implicit self passing …

  4. What is the purpose of the `self` parameter? Why is it needed?

    For a language-agnostic consideration of the design decision, see What is the advantage of having this/self pointer mandatory explicit?. To close debugging questions where OP omitted a self …

  5. ¿Para qué sirve Self y This en PHP? - Stack Overflow en español

    Jan 10, 2018 · quería saber el uso de estos dos y sus diferencias. He visto que tienen un uso parecido, pero lo que he visto no explican realmente cuál es mejor usar y por qué.

  6. php - When should I use 'self' over '$this'? - Stack Overflow

    In PHP 5, what is the difference between using self and $this? When is each appropriate?

  7. Python. Что такое self, наследование и с чем их едят?

    Что же такое self, как работает передача определенных значений переменных между функциями и как это все между собой работает? Дело в том, что я задался целью написать небольшую …

  8. Why do I get "TypeError: Missing 1 required positional argument: 'self'"?

    See Why do I get 'takes exactly 1 argument (2 given)' when trying to call a method? for the opposite problem.

  9. What difference does it make to use "self" to define a member in a ...

    A.x is a class variable. B 's self.x is an instance variable. i.e. A 's x is shared between instances. It would be easier to demonstrate the difference with something that can be modified like a list:

  10. How to avoid explicit 'self' in Python? - Stack Overflow

    Dec 31, 2009 · The "self" is the conventional placeholder of the current object instance of a class. Its used when you want to refer to the object's property or field or method inside a class as if you're …