About 7,340,000 results
Open links in new tab
  1. oop - Why do you need explicitly have the "self" argument in a …

    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 …

  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 …

  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 …

  4. Difference between Python self and Java this - Stack Overflow

    Feb 11, 2014 · Moving further: Technically both self and this are used for the same thing. They are used to access the variable associated with the current instance. Only difference is, you …

  5. Why do I get "TypeError: Missing 1 required positional argument: …

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

  6. When to use self, &self, &mut self in methods? - Stack Overflow

    Nov 24, 2019 · Say I want to implement a method that pretty prints the struct to stdout, should I take &self? I guess self also works? As you can see, this is exactly a case for &self. If you use …

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

  8. class - Python - self, no self and cls - Stack Overflow

    The same way self is used to access an attribute inside the object (class) itself. Not inside the object / class, just inside the class' instance methods. self is just a convention, you could call it …

  9. How can I create a self-signed certificate for 'localhost'?

    I've gone through the steps detailed in How do you use HTTPS and SSL on 'localhost'?, but this sets up a self-signed certificate for my machine name, and when browsing it via …

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

    The W3C's WebAppSec Working Group is starting to look at the issue. See, for example, Proposal: Marking HTTP As Non-Secure. How to create a self-signed certificate with …