staticmethod()
staticmethod to get static method for a given functions.
By using classmethod(), we work with class , whereas staticmethod() has nothing to do with class.
Example:
class animals():
def __init__(self,name,height):
self.name= name
self.height=height
def legs(no_legs):
print("legs: ",no_legs)
animals.legs=staticmethod(animals.legs)
animals.legs(4)
Output
legs : 4
Using isinstance()
By using isinstance() we can check if the object is instance of the class or not.
«All Built in Functions in Python
locals()
dir() ord()
← Subscribe to our YouTube Channel here
This article is written by plus2net.com team.
https://www.plus2net.com
plus2net.com