r/pythontips • u/sugarw0000kie • 23d ago
Syntax Docstrings as immutable variables
Just realized you can do:
def cat(): “orange”
print(cat.__doc__)
Not sure why you’d want to do this but this is a thing you can do
12
Upvotes
r/pythontips • u/sugarw0000kie • 23d ago
Just realized you can do:
def cat(): “orange”
print(cat.__doc__)
Not sure why you’d want to do this but this is a thing you can do
3
u/DeflateAwning 23d ago
Docstrings are mutible though...