def __init__(self, *args):
if isinstance(args[0], date):
# это date
elif all(isinstance(arg, int) for arg in args[0:3]):
# это 3 int
help(cls.__init__)
def func():
if inspect.stack()[1].function == '_with':
print('called from with')
else:
print('called not from with')
func() # >> called not from with
def _with():
func()
_with() # >> called from with