Code Yarns ‍👨‍💻
Tech BlogPersonal Blog

Python: Docstrings

📅 2009-Oct-06 ⬩ ✍️ Ashwin Nanjappa ⬩ 📚 Archive

def foobar():
    """Calculate the speed of thought."""
    return
    
    class Light:
        """Light and its attributes."""
        def __init__(self):
            return
    
print(foobar.__doc__)   # Calculate the speed of thought.
print(Light.__doc__)    # Light and its attributes.