0

Looks like it is impossible, but I'll try to ask...

Let's say I have this function:

def something(x)

  def subsomething(x):
    return 'a' if x == 1 else 'b'

  message = f'the character is {subsomething(x)}'
  return message

Is it possible to patch subsomething's return value and set it to c without changing something?

rzlvmp
  • 7,512
  • 5
  • 16
  • 45
  • 2
    No, it's not possible. – thebjorn Apr 26 '22 at 08:41
  • Does this answer your question? [Can you patch \*just\* a nested function with closure, or must the whole outer function be repeated?](https://stackoverflow.com/questions/27550228/can-you-patch-just-a-nested-function-with-closure-or-must-the-whole-outer-fun) – MrBean Bremen Apr 26 '22 at 08:54

0 Answers0