Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #26958

Official reason for omitting inspect.currentcallable() ?

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 <no.email@please.post>
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 <k09ctb$66t$1@reader1.panix.com> (permalink)
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

Show key headers only | View raw



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.

Back to comp.lang.python | Previous | NextNext in thread | Find similar | Unroll thread


Thread

Official reason for omitting inspect.currentcallable() ? kj <no.email@please.post> - 2012-08-12 23:06 +0000
  Re: Official reason for omitting inspect.currentcallable() ? Terry Reedy <tjreedy@udel.edu> - 2012-08-13 01:15 -0400
  Re: Official reason for omitting inspect.currentcallable() ? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-08-13 08:24 +0000
    Re: Official reason for omitting inspect.currentcallable() ? Chris Angelico <rosuav@gmail.com> - 2012-08-13 18:51 +1000
      Re: Official reason for omitting inspect.currentcallable() ? kj <no.email@please.post> - 2012-08-13 14:16 +0000

csiph-web