About 8,430,000 results
Open links in new tab
  1. 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 …

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

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

  4. oop - Why do you need explicitly have the "self" argument in a …

    Many have proposed to make self a keyword in Python, like this in C++ and Java. This would eliminate the redundant use of explicit self from the formal parameter list in methods.

  5. What does "\\.self" actually do in Swift/SwiftUI? - Stack Overflow

    Jul 4, 2020 · I think it is setting the id for each list item as each item in the numbers array? Correct me if wrong - but is each id being set as whatever Int is in each entry of the numbers array? If …

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

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

  8. rust - Understanding the 'self' parameter in the context of trait ...

    Nov 1, 2016 · When implementing a trait, we often use the keyword self, a sample is as follows. I want to understand the representation of the many uses of self in this code sample. struct …

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

  10. Python: "self" in inheritance - Stack Overflow

    A basic question on inheritance and "self" here. Good code with no error: (Correction: Turns out this is NOT GOOD, either. Please refer to MisterMiyagi's answers below.) class A: def __init__(...