akhilthomas3
New Coder
Is it possible in Python to have 'abstract functions' without a base class? I'm not sure if this is the correct terminology, but I'd like to compel a group of utility functions to conform to some kind of signature.
For example, in the code below, which I applied from the source; I'd like to use the @someSignature decorator to require any function tagged with it to take those two parameters and return true or false. How can I do that?
Please assist me if you can
Thanks in advance!
For example, in the code below, which I applied from the source; I'd like to use the @someSignature decorator to require any function tagged with it to take those two parameters and return true or false. How can I do that?
Code:
@someSignature
def perform_action(user, object):
return True
@someSignature
def perform_action_2(user, object):
return False
Thanks in advance!
Last edited: