Skip to content
Magenaut

Magenaut

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

self

What does new self(); mean in PHP?

October 17, 2022 by Magenaut

I’ve never seen code like this:

Categories PHP, Q&A Tags class, php, self Leave a comment

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

Recent Comments

  • silverplugins217 on How to add placeholder for contact form7 for dropdown?
  • Shreyas Ikhar on How to add a custom CSS class to core blocks in Gutenberg editor?
  • Magenaut on How to call function on timer ASP.NET MVC
  • Ebaad Uddin on How to call function on timer ASP.NET MVC
  • michealSmith07 on Is there a way to dynamically refresh the less command?

Tags

.net adobe-illustrator adobe-photoshop ajax arrays asp.net asp.net-core asp.net-mvc bash c# css database django eloquent express html java javascript jquery json laravel laravel-4 laravel-5 laravel-8 linux list mongodb mongoose mysql node.js npm pandas php python python-3.x react-hooks react-native react-router reactjs redux regex sql string typescript wordpress
© 2023 Magenaut • Built with GeneratePress