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


Groups > comp.lang.python > #26972

Re: Official reason for omitting inspect.currentcallable() ?

References <k09ctb$66t$1@reader1.panix.com> <5028b9ce$0$29867$c3e8da3$5496439d@news.astraweb.com>
Date 2012-08-13 18:51 +1000
Subject Re: Official reason for omitting inspect.currentcallable() ?
From Chris Angelico <rosuav@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.3221.1344847903.4697.python-list@python.org> (permalink)

Show all headers | View raw


On Mon, Aug 13, 2012 at 6:24 PM, Steven D'Aprano
<steve+comp.lang.python@pearwood.info> wrote:
> On Sun, 12 Aug 2012 23:06:19 +0000, kj wrote:
>
>> 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?
>
> I doubt it. Should there be? "currentcallable" is not a standard function
> in any language I'm familiar with, although I may be missing something
> obvious.

I'm not familiar with it by that name, but Pike's this_function is
what the OP's describing.

(Yes, I'm citing Pike again. Sorry.)

It's a useful construct in theory when you want to write in recursion,
which was part of the rationale behind PEP 3130 (btw, Terry, it would
have been nice if you'd mentioned the number instead of sending me to
the index to try to figure out which one you were referring to, but
anyway). But how often is it actually useful in practice? I've never
actually used this_function other than in writing a crazy recursive
lambda (was testing different languages' handling of infinite
recursion - high level languages shouldn't segfault, one much-maligned
language DOES).

ChrisA

Back to comp.lang.python | Previous | NextPrevious in thread | Next 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