0

I'm playing with tf.autograph.to_code and I'm wondering if there is a way to obtain programmatically the code of a standard Python function.

Something like this:

def sign(x):
    if x > 0:
        return 'Positive'
    else:
        return 'Negative or zero'
mycode = magic_function(sign)
print(mycode)

Returning:

if x > 0:
    return 'Positive'
else:
    return 'Negative or zero'
Park
  • 1,924
  • 1
  • 15
  • 19
MarcoM
  • 999
  • 7
  • 21

0 Answers0