Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!feeder.news-service.com!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.009 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'from:addr:python': 0.09; 'message-id:@webmail.messagingengine.com': 0.09; 'subject:Function': 0.09; 'x-mailer:messagingengine.com webmail interface': 0.09; '"""this': 0.16; 'from:addr:bdurham.com': 0.16; 'subject:variable': 0.16; 'test()': 0.16; 'test():': 0.16; 'def': 0.16; 'received:internal': 0.19; 'header:In-Reply-To:1': 0.22; 'received:10.202': 0.23; 'received:10.202.2': 0.23; 'received:66.111': 0.23; 'received:66.111.4': 0.23; 'received:messagingengine.com': 0.23; 'received:smtp.messagingengine.com': 0.23; 'string': 0.26; 'function': 0.26; "i'm": 0.27; 'generic': 0.29; 'malcolm': 0.30; 'print': 0.32; 'to:addr:python-list': 0.34; 'doc': 0.35; 'itself,': 0.35; 'charset:us-ascii': 0.36; 'but': 0.37; 'subject:: ': 0.38; 'to:addr:python.org': 0.39; 'header:Message-Id:1': 0.61; 'from:no real name:2**0': 0.62; 'subject:local': 0.84; 'technique': 0.93 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=messagingengine.com; h=message-id:from:to:mime-version:content-transfer-encoding:content-type:references:subject:in-reply-to:date; s=smtpout; bh=gs65hUPZc03wefeTjwWf6bVhgqA=; b=c8ukSjheLYOsyYO5Vc7cPbQpmRJ73b0FRMUTsip7mPgqs6eJIZu34o3W6lzxHclZFix2jbGi5SL50+6xPrwNvNUGl1OQNsC9DpQN0xcpEzn8eqUuL+HlD3hR2YQPVuIbvTI2mDQYJutXEigYS59UnGOlKAAoRY8MmLEaYcT6IrE= X-Sasl-Enc: 0Wjdbptj0jXr4SeeMhLEDrM1GdxBvEYUbYw71yziZL6n 1310336009 From: python@bdurham.com To: python-list@python.org MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii" X-Mailer: MessagingEngine.com Webmail Interface References: <20110710174121.GB12935@johnsons-web.com><4E19E5A5.5020905@gmail.com> Subject: Re: Function docstring as a local variable In-Reply-To: Date: Sun, 10 Jul 2011 18:13:29 -0400 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 14 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1310336017 news.xs4all.nl 21858 [2001:888:2000:d::a6]:57402 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:9186 I'm not sure how a function can get a generic handle to itself, but if you're willing to hardcode the function name, then this technique works: def test(): """This is my doc string""" print test.__doc__ test() Outputs: This is my doc string Malcolm