Skip to content

Magenaut

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

methods

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

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

Python: Bind an Unbound Method?

August 20, 2022 by Magenaut

In Python, is there a way to bind an unbound method without calling it?

Categories Python, Q&A Tags bind, class, methods, python Leave a comment

id()s of bound and unbound method objects — sometimes the same for different objects, sometimes different for the same object

August 20, 2022 by Magenaut

I’ve tried some code about bound and unbound methods. When we call them, I think both of them would return objects. But when I use id() for getting some information, it returns something I don’t understand.

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

Why does Python code use len() function instead of a length method?

August 19, 2022 by Magenaut

I know that python has a len() function that is used to determine the size of a string, but I was wondering why it’s not a method of the string object.

Categories Python, Q&A Tags function, methods, oop, python, string-length Leave a comment

Safe method to get value of nested dictionary

August 19, 2022 by Magenaut

I have a nested dictionary. Is there only one way to get values out safely?

Categories Python, Q&A Tags dictionary, except, methods, python Leave a comment

Why do some functions have underscores “__” before and after the function name?

August 18, 2022 by Magenaut

This “underscoring” seems to occur a lot, and I was wondering if this was a requirement in the Python language, or merely a matter of convention?

Categories Python, Q&A Tags double-underscore, function, methods, python Leave a comment

Difference between methods and functions, in Python compared to C++

August 18, 2022 by Magenaut

I’m doing Code Academy’s tutorials on Python, and I’m a bit confused about the definition of method and function. From the tutorial:

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

Inheritance of private and protected methods in Python

August 17, 2022 by Magenaut

I know, there are no ‘real’ private/protected methods in Python. This approach isn’t meant to hide anything; I just want to understand what Python does.

Categories Python, Q&A Tags inheritance, methods, private, protected, python Leave a comment
Older posts
Newer posts
← Previous Page1 Page2 Page3 Page4 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