About 167,000 results
Open links in new tab
  1. Difference between Python self and Java this - Stack Overflow

    Feb 11, 2014 · Only difference is, you have to include self explicitly as first parameter to an instance method in Python, whereas this is not the case with Java. Moreover, the name self …

  2. python - What is the purpose of the `self` parameter? Why is it …

    Python decided to do methods in a way that makes the instance to which the method belongs be passed automatically, but not received automatically: the first parameter of methods is the …

  3. python - Why do pythonistas call the current reference "self" …

    Jul 3, 2009 · With respect to python, there is nothing special about self. You can use this instead if you wanted: Here's an example: >>> class A(object): ... def __init__(this): ... this.x = 3 ... >>> a …

  4. Understanding the Difference Between Python's 'self' and Java's …

    'self' is a conventional name for the first parameter of instance methods in Python, while 'this' is a reserved keyword in Java. In Python, 'self' needs to be explicitly defined in instance methods, …

  5. Distinguishing Python’s ‘self’ from Java’s ‘this’

    Sep 24, 2024 · In Python, ‘self’ is an explicit parameter that needs to be included in the method definition, whereas ‘this’ in Java is implicit and does not require explicit declaration. In Python, …

  6. Object-Oriented Programming in Python vs Java

    In this step-by-step tutorial, you'll learn about the practical differences in Python vs Java for object-oriented programming. By the end, you'll be able to apply your knowledge to Python, …

  7. What is the difference between self and $this - GeeksforGeeks

    Mar 11, 2024 · The keyword self is used to refer to the current class itself within the scope of that class only whereas, $this is used to refer to the member variables and function for a particular …

  8. self in Python class - GeeksforGeeks

    Feb 26, 2025 · In Python, self is used as the first parameter in instance methods to refer to the current object. It allows methods within the class to access and modify the object’s attributes, …

  9. Understanding the Difference Between Python's self and Java's this

    In the realm of object-oriented programming, Python's 'self' and Java's 'this' serve similar functions but come with important distinctions. What is 'self' in Python? In Python, 'self' is a …

  10. Why do you need "self." in Python to refer to instance variables?

    Nov 22, 2015 · In Java, you don't need to prefix member variables with "this.", but in Python "self." is always required. The reason is that Python does not have an explicit syntax for declaring …

  11. Some results have been removed
Refresh