This commit is contained in:
adii1823
2021-10-28 17:38:47 +05:30
parent ef37ce0c4e
commit b6eb3ef8a7
32 changed files with 1063 additions and 0 deletions
+18
View File
@@ -0,0 +1,18 @@
# oop/simplest.class.py
class Simplest(): # when empty, the braces are optional
pass
print(type(Simplest)) # what type is this object?
simp = Simplest() # we create an instance of Simplest: simp
print(type(simp)) # what type is simp?
# is simp an instance of Simplest?
print(type(simp) is Simplest) # There's a better way to do this
"""
$ python simplest.class.py
<class 'type'>
<class '__main__.Simplest'>
True
"""