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


Groups > comp.lang.python > #10928

Re: Get the name of a function

Path csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder3.hal-mli.net!news.shlink.de!news.iphh.net!iphh.net!nntp.ilk.net!noris.net!news2.arglkargh.de!news.wiretrip.org!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.001
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'oct': 0.02; 'python': 0.08; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:80.91.229.12': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'received:lo.gmane.org': 0.09; 'def': 0.15; '"copyright",': 0.16; '"credits"': 0.16; '"license"': 0.16; '[gcc': 0.16; 'linux2': 0.16; 'received:173.11': 0.16; 'subject:function': 0.16; '>>>': 0.18; 'header:In-Reply-To:1': 0.22; 'function': 0.27; 'all,': 0.28; 'there': 0.33; 'to:addr :python-list': 0.33; 'header:User-Agent:1': 0.34; 'header:X -Complaints-To:1': 0.35; 'but': 0.37; 'received:org': 0.38; 'subject:: ': 0.39; 'header:Mime-Version:1': 0.39; 'to:addr:python.org': 0.39; 'more': 0.60; 'subject:name': 0.67; 'subject:Get': 0.71; "'test'": 0.84
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Emile van Sebille <emile@fenx.com>
Subject Re: Get the name of a function
Date Fri, 05 Aug 2011 13:19:30 -0700
References <8295aba8-3eab-4c6e-b3b7-c3421d829220@f7g2000vba.googlegroups.com>
Mime-Version 1.0
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
X-Gmane-NNTP-Posting-Host 173-11-108-137-sfba.hfc.comcastbusiness.net
User-Agent Mozilla/5.0 (Windows NT 5.1; rv:5.0) Gecko/20110624 Thunderbird/5.0
In-Reply-To <8295aba8-3eab-4c6e-b3b7-c3421d829220@f7g2000vba.googlegroups.com>
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.1940.1312575911.1164.python-list@python.org> (permalink)
Lines 22
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1312575911 news.xs4all.nl 23950 [2001:888:2000:d::a6]:40696
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:10928

Show key headers only | View raw


On 8/5/2011 11:52 AM gervaz said...
> Hi all, is there a way to retrive the function name like with
> self.__class__.__name__?

yes, but not reliably:

Python 2.6.4rc2 (r264rc2:75497, Oct 20 2009, 02:55:11)
[GCC 4.4.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
 >>> def test():pass
...
 >>> test.__name__
'test'
 >>> b=test
 >>> b.__name__
'test'
 >>>


Emile

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


Thread

Get the name of a function gervaz <gervaz@gmail.com> - 2011-08-05 11:52 -0700
  Re: Get the name of a function Emile van Sebille <emile@fenx.com> - 2011-08-05 13:19 -0700
  Re: Get the name of a function Chris Rebert <clp2@rebertia.com> - 2011-08-05 14:19 -0700
  Re: Get the name of a function Grant Edwards <invalid@invalid.invalid> - 2011-08-05 22:05 +0000

csiph-web