OOP noob here.. But.. is it possible to call a function after a function. I don't know how to describe it, so I'll ask it with an example:
class Human:
def __init__(self, name, age):
self.name = name
self.age = age
self.email = ''
def set_email(self, email):
self.email = email
def print_email(self):
print("You email is: {}".format(self.email))
def with_name(self):
print("Your name is {} and email is {}".format(self.name, self.email))
subject = Human("Bucky", 24)
subject.set_email("bucky@gmail.com")
subject.print_email().with_name() # Doubt here
Is it possible to call a function after .print_email()
such as .with_name()
so that the email gets printed with name and the print
function in the .print_email()
function doesn't gets printed at all??
Saw this type of thing in Javascript, was thinking that is it possible here in python?