A decorator in Python is any callable Python object that is used to modify a function or a class. In this post, we’ll first discuss what decorators are, followed by a discussion on classmethods and staticmethods along with the property decorator.
A guide on classmethods, staticmethods and the property decorator in OOP (Object Oriented Programming)
The Object Oriented Programming paradigm became popular in the ’60s and ‘70s, in languages like Lisp and Smalltalk. Such features were also added to existing languages like Ada, Fortran and Pascal.
Python is an object oriented programming language, though it doesn’t support strong encapsulation.
Introductory topics in object-oriented programming in Python — and more generally — include things like defining classes, creating objects, instance variables, the basics of inheritance, and maybe even some special methods like
__str__. But when we have an advanced look, we could talk about things like the use of decorators, or writing a custom
new method, metaclasses, and Multiple Inheritance.
In this post, we’ll first discuss what decorators are, followed by a discussion on classmethods and staticmethods along with the property decorator.
Classmethods, staticmethods and property are examples of what are called descriptors. These are objects which implement the
But, that’s a topic for another post.
We’ll talk about the following in this article:
Guide to Python Programming Language
OOP in Python will help you understand how to write various basic programs in python and real-time uses of some of the Python libraries as well.
Python is an interpreted, high-level, powerful general-purpose programming language. You may ask, Python’s a snake right? and Why is this programming language named after it?
Python Hello World Program - Your first step towards Python world. Learn how to create the Hello World Python program in PyCharm.
Python Programming Tutorials For Beginners