Quick actions

cmd+k|ctrl+k

Navigation

Languages

20240418 Class type

Snippet info

Language

Python

Visibility

public

Author

maxine-chiu

Created

2024-04-18T04:02:19.191064Z

Updated

2024-04-18T04:37:23.975392Z

class Person:
    name : "Ryan"  #  {name : "Ryan"}
    age = 30    # age : 30 attribute, namespace
    def __init__(self, sex):
        self.sex = sex
    def greet(self): # greet : f()  methode
        print("hello")
print(type(Person))
print(Person.__name__)
print(type(1))
p = Person("male")
print(type(p))
print(p.__class__)
print(isinstance(p,Person), isinstance(p,str))  # check the object from which class
#help(type)
print(isinstance(Person,Person))
print(Person.__dict__)

INFO