About Callable Function Arguments
Using callable() you can allow a function to accept either values or functions that return values. Here is an example of the pattern:
from datetime import datetime
def do_something(timestamp=datetime.now):
if callable(timestamp):
timestamp = timestamp()
print(timestamp)
Also by me
Django Messaging 🎅🏼
For Django-based social platforms.
Django App for You
Django Paddle Subscriptions 🎅🏼
For Django-based SaaS projects.
Django App for You
Django GDPR Cookie Consent 🎅🏼
For Django websites that use cookies.
Django App for You