Top "Self" questions

A keyword used in instance methods to refer to the object on which they are working.

What __init__ and self do in Python?

I'm learning the Python programming language and I've came across something I don't fully understand. In a method like: def …

python oop self
What is the purpose of the word 'self'?

What is the purpose of the self word in Python? I understand it refers to the specific object created from …

python class oop self
TypeError: method() takes 1 positional argument but 2 were given

If I have a class... class MyClass: def method(arg): print(arg) ...which I use to create an object... my_…

python python-3.x methods arguments self
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__(…

python class object terminology self
python global name 'self' is not defined

Just started learning python and I am sure its a stupid question but I am trying something like this: def …

python variables self
Python decorators in classes

Can one write something like: class Test(object): def _decorator(self, foo): foo() @self._decorator def bar(self): pass This …

python class decorator self
Why do you need explicitly have the "self" argument in a Python method?

When defining a method on a class in Python, it looks something like this: class MyClass(object): def __init__(self, …

python oop methods self
Python calling method without 'self'

So I just started programming in python and I don't understand the whole reasoning behind 'self'. I understand that it …

python class self
WPF Bind to itself

I've got a WPF Window, and somewhere there is a ListView where I bind a List<string> to. …

wpf data-binding binding self
What does new self(); mean in PHP?

I've never seen code like this: public static function getInstance() { if ( ! isset(self::$_instance)) { self::$_instance = new self(); } return self::$_…

php class self