liveBook · Manning

Static method

As explained in Software Design for Python Programmers

A static method is a class-associated method that receives no implicit instance or class reference and can be called through either the class or an instance.

A static method is a class-associated function that receives no implicit object reference. In Python, @staticmethod removes the self parameter, so the method operates only on explicitly supplied arguments. It can be called through the class or an instance. section 2.3.1 section 2.3

Case-insensitive catalogue matching

Catalogue._equal_ignore_case(target_str, other_str) compares two strings without using Catalogue instance state. An empty target string returns True, allowing wildcard search fields. The instance method _is_match() calls this helper for each book title, last name, and first name. section 2.3.1

How Software Design for Python Programmers covers it

How deep it goes
Explains the decorator, omitted self parameter, explicit arguments, and class-or-instance invocation through a working example.
Examples
Demonstrates Catalogue._equal_ignore_case() within wildcard-aware book searches.
What it assumes
Assumes basic functions, methods, classes, objects, and instance variables while distinguishing static methods from regular methods.
What you can do after
Apply it via Python's @staticmethod decorator to define class-associated behavior that depends only on explicit arguments.
How it connects
Connects static methods with functions, regular methods, classes, objects, and instance variables.

Also explained in

Compare how 5 books explain static method →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Software Design for Python Programmers. The section links point to the parts of the book it draws on.