+ 3

print("...") V/s """docstrings"""!!!!!

This got me thinking....suppose I want user to see some comment from me (the dev, that is), should I just use print("...") or use """docstrings""" along with help(func_name)?? Which would use less resources?? Is one better than the other in some particular cases??

7th Feb 2019, 2:02 PM
HooliganM
HooliganM - avatar
1 ответ
+ 2
If you should define a function just to display docstring, when help(func_name) is called it doesn't sound good. I did a test with a method timeit from a module timeit and compared those ways, print("comment") was about 2000* faster than help(func).
10th Feb 2019, 10:50 AM
Seb TheS
Seb TheS - avatar