About 12,700,000 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 - 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 …

  3. 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 …

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

    So, in the first method self specifies that Python should use the variable (attribute), that "belongs" to the class object we created, not a global one (outside the class).

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

    The self keyword in Python is analogous to this keyword in C++ / Java / C#. In Python 2 it is done implicitly by the compiler (yes Python does compilation internally).

  6. 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 …

  7. Python class methods: when is self not needed - Stack Overflow

    Jun 25, 2017 · 17 What is self? In Python, every normal method is forced to accept a parameter commonly named self. This is an instance of class - an object. This is how Python methods interact …

  8. Difference between 'cls' and 'self' in Python classes?

    Why is cls sometimes used instead of self as an argument in Python classes? For example: class Person: def __init__(self, firstname, lastname): self.firstname = firstname self.

  9. How can I generate a self-signed SSL certificate using OpenSSL?

    A self-signed certificate does not chain back to a trusted anchor. The best way to avoid this is: Create your own authority (i.e., become a CA) Create a certificate signing request (CSR) for the server Sign …

  10. Content Security Policy: "img-src 'self' data:" - Stack Overflow

    Nov 1, 2016 · 83 I have an app, in which the user would be able to copy an image URL, paste it unto an input and the image will be loaded on a box. But my app, keeps triggering this message: Refused to …