On Sunday, July 10, 2011 4:06:27 PM UTC-7, Corey Richardson wrote:
> Excerpts from Carl Banks's message of Sun Jul 10 18:59:02 -0400 2011:
> > print __doc__
> >
>
> Python 2.7.1 (r271:86832, Jul 8 2011, 22:48:46)
> [GCC 4.4.5] on linux2
> Type "help", "copyright", "credits" or "license" for mor
On Jul 11, 9:06 am, Corey Richardson wrote:
> Excerpts from Carl Banks's message of Sun Jul 10 18:59:02 -0400 2011:
>
> > print __doc__
>
> Python 2.7.1 (r271:86832, Jul 8 2011, 22:48:46)
> [GCC 4.4.5] on linux2
> Type "help", "copyright", "credits" or "license" for more information.>>> def
> fo
On Jul 11, 9:00 am, Corey Richardson wrote:
> def qux():
> 'And even me! Quote type don't matter (besides style)'
Well, style and the presence of the string literal notation in the
quoted text :)
--
http://mail.python.org/mailman/listinfo/python-list
On Mon, 11 Jul 2011 09:00 am Corey Richardson wrote:
> Excerpts from Colin J. Williams's message of Sun Jul 10 18:28:15 -0400
> 2011:
>> Try:
>>
>> def f():
>> ds= """docstring"""
>> print ds
>
> That doesn't actually make a docstring, though. It makes a string object
> and points th
Excerpts from Chris Rebert's message of Sun Jul 10 20:16:23 -0400 2011:
> The question Carl's code was in answer to was, slightly paraphrased:
> "Is it possible to get a *module*'s docstring from within the module
> itself?"
> The question had nothing to do with *function* docstrings.
>
Ah. My ba
* Chris Rebert [110710 16:14]:
> >
> > Where is general documentation on the subject of variables
> > beginning with 2 underscores?
>
> I've never heard that phrase used to describe __doc__ or its friends.
:) That why I wasn't satified with my search results.
> Look in the "underscore" sectio
On Sun, Jul 10, 2011 at 4:06 PM, Corey Richardson wrote:
> Excerpts from Carl Banks's message of Sun Jul 10 18:59:02 -0400 2011:
>> print __doc__
>>
>
> Python 2.7.1 (r271:86832, Jul 8 2011, 22:48:46)
> [GCC 4.4.5] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
On Sun, Jul 10, 2011 at 5:00 PM, Tim Johnson wrote:
> * Carl Banks [110710 15:18]:
>> On Sunday, July 10, 2011 3:50:18 PM UTC-7, Tim Johnson wrote:
>> > ## Is it possible to get the module docstring
>> > ## from the module itself?
>>
>> print __doc__
> Thanks Carl.
>
> Where is general docum
* Carl Banks [110710 15:18]:
> On Sunday, July 10, 2011 3:50:18 PM UTC-7, Tim Johnson wrote:
> > Here's a related question:
> > I can get the docstring for an imported module:
> > >>> import tmpl as foo
> > >>> print(foo.__doc__)
> > Python templating features
> >
> >Author - tim at
"Colin J. Williams" writes:
> On 10-Jul-11 13:44 PM, rantingrick wrote:
> > On Jul 10, 12:41 pm, Tim Johnson wrote:
> >> It possible for a function to print it's own docstring?
> >
> > def f():
> > """docstring"""
> > print "docstring"
>
> Try:
>
> def f():
> ds= """docstring"""
>
-BEGIN PGP SIGNED MESSAGE-
Hash: RIPEMD160
On 2011.07.10 06:06 PM, Corey Richardson wrote:
> Python 2.7.1 (r271:86832, Jul 8 2011, 22:48:46) [GCC 4.4.5] on
> linux2 Type "help", "copyright", "credits" or "license" for more
> information.
def foo():
> ... "Docstring" ... print
On 07/10/2011 05:50 PM, Tim Johnson wrote:
* pyt...@bdurham.com [110710 14:17]:
def test():
"""This is my doc string"""
print test.__doc__
test()
Works for me. Works for the application I'm after. thanks
Here's a related question:
## Is it possible to get the module docstrin
Excerpts from Carl Banks's message of Sun Jul 10 18:59:02 -0400 2011:
> print __doc__
>
Python 2.7.1 (r271:86832, Jul 8 2011, 22:48:46)
[GCC 4.4.5] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> def foo():
... "Docstring"
... print __doc__
...
>>>
Excerpts from Colin J. Williams's message of Sun Jul 10 18:28:15 -0400 2011:
> Try:
>
> def f():
> ds= """docstring"""
> print ds
That doesn't actually make a docstring, though. It makes a string object and
points the name ds at it. Do you know what a docstring is?
def foo():
"""
On Sunday, July 10, 2011 3:50:18 PM UTC-7, Tim Johnson wrote:
> Here's a related question:
> I can get the docstring for an imported module:
> >>> import tmpl as foo
> >>> print(foo.__doc__)
> Python templating features
>
>Author - tim at akwebsoft dot com
>
> ## Is it possible to
* pyt...@bdurham.com [110710 14:17]:
> 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()
Works for me. Works for
In article ,
pyt...@bdurham.com wrote:
> 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:
>
> Thi
On 10-Jul-11 13:44 PM, rantingrick wrote:
On Jul 10, 12:41 pm, Tim Johnson wrote:
It possible for a function to print it's own docstring?
def f():
"""docstring"""
print "docstring"
any questions?
Try:
def f():
ds= """docstring"""
print ds
>
Colin W.
--
http://mail.pyth
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
--
http://mail.python.org/mailman/li
> >>> def findself():
>
> """Find myself. Ooh look, there I am!"""
> import sys
> try:
> 1/0
> except:
> traceback=sys.exc_info()[2]
> # Now I'm not sure what to do with traceback.
> # traceback.tb_frame.f_code.co_name
* Andrew Berg [110710 09:59]:
> -BEGIN PGP SIGNED MESSAGE-
> Hash: RIPEMD160
>
> On 2011.07.10 12:41 PM, Tim Johnson wrote:
> > It possible for a function to print it's own docstring?
> >>> def test():
> ... """Hi there."""
> ... print(test.__doc__)
Holy Moly. Of course!
thank
On Mon, Jul 11, 2011 at 3:47 AM, Andrew Berg wrote:
> -BEGIN PGP SIGNED MESSAGE-
> Hash: RIPEMD160
>
> On 2011.07.10 12:41 PM, Tim Johnson wrote:
>> It possible for a function to print it's own docstring?
def test():
> ... """Hi there."""
> ... print(test.__doc__)
That's assu
-BEGIN PGP SIGNED MESSAGE-
Hash: RIPEMD160
On 2011.07.10 12:41 PM, Tim Johnson wrote:
> It possible for a function to print it's own docstring?
>>> def test():
... """Hi there."""
... print(test.__doc__)
...
>>> test()
Hi there.
- --
CPython 3.2 | Windows NT 6.1.7601.17592 | Thun
On Jul 10, 12:41 pm, Tim Johnson wrote:
> It possible for a function to print it's own docstring?
def f():
"""docstring"""
print "docstring"
any questions?
--
http://mail.python.org/mailman/listinfo/python-list
Consider the following:
## code
def test():
"""This is my docstring"""
print(??) ## can I print the docstring above?
## /code
It possible for a function to print it's own docstring?
thanks
(pointers to docs could be sufficient)
--
Tim
tim at johnsons-web dot com or akwebsoft dot com
htt
25 matches
Mail list logo