Iam_Sandeep

Untitled

Feb 22nd, 2026
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.29 KB | None | 0 0
  1. def process_data(obj):
  2.     # Check if the object has an attribute named 'process'
  3.     # and verify that it is callable.
  4.     if hasattr(obj, 'process') and callable(obj.process):
  5.         return obj.process()
  6.    
  7.     # Return None if it doesn't exist or isn't callable
  8.     return None
  9.  
Advertisement
Add Comment
Please, Sign In to add comment