Skip to content

Magenaut

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

oop

Usage of __slots__?

August 21, 2022 by Magenaut

What is the purpose of __slots__ in Python — especially with respect to when I would want to use it, and when not?

Categories Python, Q&A Tags oop, python, python-internals, slots Leave a comment

Calling parent class __init__ with multiple inheritance, what’s the right way?

August 21, 2022 by Magenaut

Say I have a multiple inheritance scenario:

Categories Python, Q&A Tags inheritance, multiple-inheritance, oop, python, super Leave a comment

Spawning multiple instances of the same object concurrently in python

August 21, 2022 by Magenaut

I’m a beginner programmer who is starting with python and I’m starting out by making a game in pygame.
The game basically spawns circles at random positions and when clicked, it gives you points.

Categories Python, Q&A Tags loops, object, oop, pygame, python Leave a comment

How do I call a parent class’s method from a child class in Python?

August 21, 2022 by Magenaut

When creating a simple object hierarchy in Python, I’d like to be able to invoke methods of the parent class from a derived class. In Perl and Java, there is a keyword for this (super). In Perl, I might do this:

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

What is the difference between a function, an unbound method and a bound method?

August 20, 2022 by Magenaut

I’m asking this question because of a discussion on the comment thread of this answer. I’m 90% of the way to getting my head round it.

Categories Python, Q&A Tags function, methods, oop, python 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

difference between variables inside and outside of __init__()

August 20, 2022 by Magenaut

Is there any difference at all between these classes besides the name?

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

Plotting with seaborn using the matplotlib object-oriented interface

August 20, 2022 by Magenaut

I strongly prefer using matplotlib in OOP style:

Categories Python, Q&A Tags matplotlib, oop, python, seaborn Leave a comment

Explaining the ‘self’ variable to a beginner

August 20, 2022 by Magenaut

I don’t immediately grok what self is pointing to. This is definitely a symptom of not understanding classes, which I will work on at some point.

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

How can I create a copy of an object in Python?

August 20, 2022 by Magenaut

I would like to create a copy of an object. I want the new object to possess all properties of the old object (values of the fields). But I want to have independent objects. So, if I change values of the fields of the new object, the old object should not be affected by that.

Categories Python, Q&A Tags copy, object, oop, python Leave a comment
Older posts
Newer posts
← Previous Page1 Page2 Page3 Page4 … Page8 Next →
  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