i have two methods New() and Edit() and another method make() that has some statements.. New() and Edit() both call make(), however there are some statements i would like to skip in make() if the calling method is new(). Take an example below
def new():
make()
def edit():
make()
def make():
statement 1
statement 2
statement 3 not to be executed if calling method is new()
Is this implementable in Python?
Yes — put statement 3 in
edit().Alternatively, if you want other things to be able to call
make()and execute statement 3, use keyword arguments to specify a default behaviour: