#static-methods

[ follow ]
Pybites
3 months ago
Python

Exploring The Role Of Static Methods In Python: A Functional Perspective - Pybites

Static methods in Python do not require an instance or class reference and are typically used for utility functions that belong to a class but are independent of class instances.
Python's module system allows for effective namespace management and code organization, making it a viable alternative to static methods in certain scenarios. [ more ]
B-list
5 months ago
Python

Don't use class methods on Django models

Python classes support three basic types of methods: instance methods, class methods, and static methods.
Instance methods are called from an instance of the class, class methods are called from the class object itself with the class object passed as the first positional argument, and static methods are called from the class object without any implicit first argument. [ more ]
[ Load more ]