0

I have seen python functions defined within other function like this:

def une_fonction(fonction):

    def autre_fonction(*param, **param2):
        print "Action avant .............. "
        fonction(*param, **param2)
        print "Action après .............."

    return autre_fonction

  • Anyone can tell me where I can find official documentation or tutorials on this?
  • Why and how are they used?
Pat. ANDRIA
  • 2,330
  • 1
  • 13
  • 27
  • 1
    The official documentation is here: https://docs.python.org/3/reference/compound_stmts.html#function-definitions – mkrieger1 Oct 09 '20 at 07:23
  • 1
    This has less to do with functions in particular, but more with scope in general. This might help: https://docs.python.org/3/tutorial/classes.html#scopes-and-namespaces-example – user2390182 Oct 09 '20 at 07:25

0 Answers0