About 53 results
Open links in new tab
  1. class - Where is the Python documentation for the special methods ...

    Sep 13, 2009 · 3 Python's double underscore ("dunder") methods are also known as datamodel methods because they are at the core of Python's data model, providing a protocol for customizing …

  2. What are the advantages of Dunder methods in python?

    Mar 28, 2021 · 2 One of the biggest advantages of using Python's dunder methods is that they provide a simple way to make objects behave like built-in types. That means you can avoid ugly, counter …

  3. python - What is the meaning of single and double underscore before …

    What do single and double leading underscores before an object's name represent in Python?

  4. Métodos "__" ou "Dunder" em Python, quais são os mais utilizados?

    Jan 10, 2017 · Em Python existem os métodos "Mágicos", como o __len__, que permite o uso do len (object), além desse em especifico, quais são os outros mais utilizados que possam facilitar o uso da …

  5. python - How are dunder methods accessed? - Stack Overflow

    Nov 29, 2021 · While this is a reasonable exercise to understand how Python works, remember that you should not usually call dunder methods directly. Python offers other syntax that will call these …

  6. python - Dunder methods for overloading - Stack Overflow

    Aug 8, 2023 · For dunder methods like __getattribute__ and __getattr__ we have a function which access this special methods like getattr(), so we only have to use these dunder methods for overloading (i.e. …

  7. python - Is it possible to override a class' __call__ method? - Stack ...

    Feb 5, 2020 · Special methods (aka "dunder" methods) are looked-up with respect to the class of the object, so to override it you would need to change the class, not the instance.

  8. Python dunder methods wrapped as property - Stack Overflow

    Aug 13, 2023 · I stumbled upon this code that I found weird as it seems to violate the fact that python builtins call dunder methods directly from the class of the object. Using __call__ as an example, if we …

  9. Which Python dunder/magic methods do you need to implement to …

    May 21, 2019 · The methods you need to implement would depend on what makes sense for the class you are implementing. Only implement those methods which are applicable to the attributes of your …

  10. python - Is it possible to redefine or create a new dunder method to ...

    Dec 8, 2024 · This question already has answers here: Can you monkey patch methods on core types in Python? (15 answers) Is it possible to change dunder methods of built-in classes in Python? (2 …