Python

Python is a delightful programming language that lets you work quickly.

Tips

Implement a class's __call__ function to create objects that can be called like functions. For example, creating a function that maintains state across calls.

class Product:
    def __init__(self):
        print("Instance Created")

    # Defining __call__ method
    def __call__(self, a, b):
        print(a * b)

# Instance created
ans = Product()

# __call__ method will be called
ans(10, 20)

Get the fully-scoped module path of an object, e.g., webexteamssdk.models.immutable.Message, not just Message.

# Assuming 'obj' is the instance of the object
full_module_path = f"{obj.__class__.__module__}.{obj.__class__.__qualname__}"
print(full_module_path)

Resources

References

Python
Interactive graph
On this page
Tips
Resources
References