Skip to content

Python code snippet – How to check if a functions been called?

def example():
    example.has_been_called = True
    pass

example.has_been_called = False

example()

#Actual Code:
if example.has_been_called:
   print("foo bar")
See also  Python code snippet - wHow i fill the data if most values are NaN in jupyter notebook?

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.