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
  • 2,446
  • 1
  • 16
  • 25
MarcoM
  • 1,093
  • 9
  • 25

0 Answers0