Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!news-out.readnews.com!transit3.readnews.com!panix!not-for-mail From: kj Newsgroups: comp.lang.python Subject: Official reason for omitting inspect.currentcallable() ? Date: Sun, 12 Aug 2012 23:06:19 +0000 (UTC) Organization: none Lines: 33 Message-ID: NNTP-Posting-Host: panix3.panix.com X-Trace: reader1.panix.com 1344812779 6365 166.84.1.3 (12 Aug 2012 23:06:19 GMT) X-Complaints-To: abuse@panix.com NNTP-Posting-Date: Sun, 12 Aug 2012 23:06:19 +0000 (UTC) X-No-Confirm: yes User-Agent: nn/6.7.3 Xref: csiph.com comp.lang.python:26958 Is there an *explicitly stated* reason (e.g. in a PEP, or in some python dev list message) for why the inspect module (at least for Python 2.7) does not include anything like a "currentcallable()" function that would *stably*[1] return the currently executing callable object? (It seems unlikely that the absence in the inspect module of anything even remotely like such a currentcallable is merely an oversight, considering how many introspection facilities the inspect module provides. It seems far more likely that this absence is either due to some fundamental limitation of Python that makes it impossible to fully specify such a function, or it is the result of a deliberate policy against including such a function in inspect.) Thanks! [1] By "stably" above I mean, e.g., that the value returned by the top-level function (object) defined by def spam(): return inspect.currentcallable() is *invariant*, in contrast to the value returned by the top-level function (object) defined by def ham(): return ham which is whatever the current value of the 'ham' global happens to be.