How to get a function name as a string?
Using __name__ is the preferred method as it applies uniformly. Unlike func_name, it works on built-in functions as well: Also the double underscores indicate to the reader this is a special attribute. As a bonus, classes and modules have a __name__ attribute too, so you only have remember one special name.