1

When you define a function like so:

def f():
    """Does something."""
    return None

and you print it:

print(f)

You get a pretty uninformative description like "function at 0xwhatever".

I know you could just

print(f.func_name)  # python 2
print(f.__name__)  # python 3

But is there a way to provide a __repr__ for a function, just in case I ever wanted to?

MaxStrange
  • 137
  • 1
  • 10

0 Answers0