Skip to content

Magenaut

  • Home
  • Topics
    • Notes
    • Tutorial
    • Bug fixing
    • Extension
    • Server
  • Q&A
  • Privacy Policy
  • About

self

What is the purpose of the word ‘self’?

August 22, 2022 by Magenaut

What is the purpose of the self word in Python? I understand it refers to the specific object instance created from that class. But why does it explicitly need to be added to every function as a parameter? To illustrate, in Ruby I can do this:

Categories Python, Q&A Tags class, oop, python, self Leave a comment

TypeError: method() takes 1 positional argument but 2 were given

August 21, 2022 by Magenaut

If I have a class…

Categories Python, Q&A Tags arguments, methods, python, python-3.x, self Leave a comment

Why do you need explicitly have the “self” argument in a Python method?

August 20, 2022 by Magenaut

When defining a method on a class in Python, it looks something like this:

Categories Python, Q&A Tags methods, oop, python, self Leave a comment

How to keep track of class instances?

August 19, 2022 by Magenaut

Toward the end of a program I’m looking to load a specific variable from all the instances of a class into a dictionary.

Categories Python, Q&A Tags class, dictionary, instances, python, self Leave a comment

How to avoid explicit ‘self’ in Python?

August 18, 2022 by Magenaut

I have been learning Python by following some pygame tutorials.

Categories Python, Q&A Tags python, self Leave a comment

How can I decorate an instance method with a decorator class?

August 18, 2022 by Magenaut

Consider this small example:

Categories Python, Q&A Tags class, python, python-decorators, self Leave a comment

When do you use ‘self’ in Python?

August 15, 2022 by Magenaut

Are you supposed to use self when referencing a member function in Python (within the same module)?

Categories Python, Q&A Tags python, self Leave a comment
  1. michealSmith07 on Is there a way to dynamically refresh the less command?August 21, 2022

    That is a very nice post. I like this post.

  2. anonymous on Fix libwacom9 dependency issue when upgrade DebianJune 27, 2022

    saved my day!! Thanks for the help…

  3. sreedhar on Fix libwacom9 dependency issue when upgrade DebianMay 10, 2022

    Thanks its working

  4. saintnick on Fix libwacom9 dependency issue when upgrade DebianMay 10, 2022

    remove libwacom2 worked for me as well

  5. ranafoul on Fix libwacom9 dependency issue when upgrade DebianApril 22, 2022

    apt remove libwacom2 helped on kali 2022.01. gr8

.net ajax asp.net asp.net-core asp.net-mvc asp.net-mvc-3 asp.net-mvc-4 asp.net-web-api bash c# command-line css custom-post-types custom-taxonomy dataframe dictionary django entity-framework functions gridview html iis javascript jquery json linux list matplotlib numpy pandas php plugin-development plugins posts python python-2.7 python-3.x security shell shell-script sql string vb.net webforms wp-query

© 2026 Magenaut • Built with GeneratePress