-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathObject_introspection.py
More file actions
39 lines (29 loc) · 938 Bytes
/
Object_introspection.py
File metadata and controls
39 lines (29 loc) · 938 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
class Employee:
def __init__(self, fname, lname):
self.fname = fname
self.lname = lname
# self.email = f"{fname}.{lname}@codewithharry.com"
def explain(self):
return f"This employee is {self.fname} {self.lname}"
@property
def email(self):
if self.fname==None or self.lname == None:
return "Email is not set. Please set it using setter"
return f"{self.fname}.{self.lname}@codewithharry.com"
@email.setter
def email(self, string):
print("Setting now...")
names = string.split("@")[0]
self.fname = names.split(".")[0]
self.lname = names.split(".")[1]
@email.deleter
def email(self):
self.fname = None
self.lname = None
skillf = Employee("Skill", "F")
# print(skillf.email)
o = "this is a string"
# print(dir(skillf))
# print(id("that that"))
import inspect
print(inspect.getmembers(skillf))