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


Groups > comp.lang.python > #26972

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

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!feeder2.ecngs.de!ecngs!feeder.ecngs.de!xlned.com!feeder7.xlned.com!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <rosuav@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.006
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; '(at': 0.03; 'dev': 0.07; 'referring': 0.07; 'python': 0.09; 'callable': 0.09; 'pep': 0.09; 'aug': 0.13; 'index': 0.13; 'language': 0.14; 'anyway).': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'lambda': 0.16; "languages'": 0.16; 'practice?': 0.16; 'rationale': 0.16; 'mon,': 0.16; 'wrote:': 0.17; "shouldn't": 0.17; 'module': 0.19; 'received:209.85.214.174': 0.21; "i've": 0.23; 'testing': 0.24; 'least': 0.25; 'header:In-Reply-To:1': 0.25; '(e.g.': 0.27; 'handling': 0.27; 'executing': 0.27; 'message-id:@mail.gmail.com': 0.27; "d'aprano": 0.29; 'inspect': 0.29; 'steven': 0.29; "i'm": 0.29; 'function': 0.30; 'figure': 0.30; 'crazy': 0.33; 'doubt': 0.33; 'to:addr:python-list': 0.33; 'languages': 0.33; 'received:google.com': 0.34; 'list': 0.35; 'pm,': 0.35; 'received:209.85': 0.35; 'something': 0.35; 'there': 0.35; 'but': 0.36; 'useful': 0.36; 'anything': 0.36; 'should': 0.36; 'does': 0.37; 'level': 0.37; 'why': 0.37; 'received:209': 0.37; 'subject:: ': 0.38; 'behind': 0.38; 'some': 0.38; 'instead': 0.39; 'to:addr:python.org': 0.39; 'received:209.85.214': 0.39; 'skip:" 10': 0.40; 'header:Received:5': 0.40; 'high': 0.61; 'mentioned': 0.63; 'different': 0.63; 'to,': 0.65; '(yes,': 0.84; 'construct': 0.84; 'obvious.': 0.84; 'pike': 0.84; 'recursion,': 0.84; 'subject:Official': 0.84
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=H2payrEHRnx2a8MibAjOOCEs5l3oK7l/ADf5G0jNYUw=; b=W4aY57fRXpBGbkDEfcRBZ8Fy0FSXS5s2RdgrXor3BkNuhrPbPXYp5smJm3rFsUMG2S /YBWHZxuUwrQSJa1YlO2WXQmqFP816xUR89JPvkLPSZ4gHz16jARRcui3bf3QwuyF7q0 kal43Zm5glNbVFUvt2Wqjfvf0/l+k5Yul1G4f8L3D84+kFD2hBuOAttr1Ean1s49JVfl dIqnSEZjdk8IbzvVsO/vGdfrQcNJZMVpp4Uu7zRRPohDUjrrV5YHwz1xtzuKOJoTqBL7 NS+IxG1swBNU5DOxVP/4zWKLRDTsEIxXfTz6v5SH/x1WGVO1t260/hSYeoZmcjjouR6d Fjew==
MIME-Version 1.0
In-Reply-To <5028b9ce$0$29867$c3e8da3$5496439d@news.astraweb.com>
References <k09ctb$66t$1@reader1.panix.com> <5028b9ce$0$29867$c3e8da3$5496439d@news.astraweb.com>
Date Mon, 13 Aug 2012 18:51:40 +1000
Subject Re: Official reason for omitting inspect.currentcallable() ?
From Chris Angelico <rosuav@gmail.com>
To python-list@python.org
Content-Type text/plain; charset=ISO-8859-1
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.3221.1344847903.4697.python-list@python.org> (permalink)
Lines 29
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1344847903 news.xs4all.nl 6929 [2001:888:2000:d::a6]:45911
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:26972

Show key headers only | 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