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


Groups > comp.lang.python > #26958

Official reason for omitting inspect.currentcallable() ?

From kj <no.email@please.post>
Newsgroups comp.lang.python
Subject Official reason for omitting inspect.currentcallable() ?
Date 2012-08-12 23:06 +0000
Organization none
Message-ID <k09ctb$66t$1@reader1.panix.com> (permalink)

Show all headers | 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