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()


plus2net.com



Post your comments , suggestion , error , requirements etc here




We use cookies to improve your browsing experience. . Learn more
HTML MySQL PHP JavaScript ASP Photoshop Articles FORUM . Contact us
©2000-2020 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer