def args():
    """Works with fn(); yields args passed to anonymous()."""
    while True:
        # Stack frame will look like:
        #   anonymous(args=(...))      "foo(3,4,5)"
        #   gen.next()                 "return gen.next()"
        #   args.next()                internal genexp code
        yield sys._getframe(2).f_locals['args']
Works with fn(); yields args passed to anonymous().
recipes/Python/361452_Anonymous_functions_without/recipe-361452.py