Steven D'Aprano <st...@pearwood.info> writes: > I want the function to know its own context. > I don't mind if it is CPython only, or if it is a bit expensive.
That sounds crazy but if it's really what you want, you can probably fake it by examining the control stack using the backtrace module. I remember doing some hack of raising and catching an exception in order to retrieve the backtrace, but there might be a cleaner way that I didn't bother researching since it was just for a quick debugging problem. -- https://mail.python.org/mailman/listinfo/python-list