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


Groups > comp.lang.python > #9196

Re: Function docstring as a local variable

Subject Re: Function docstring as a local variable
From Corey Richardson <kb1pkl@aim.com>
References <mailman.842.1310319682.1164.python-list@python.org> <64b5198e-5cc7-4790-898e-7f1abb199230@y24g2000yqb.googlegroups.com> <ivd920$90e$1@dough.gmane.org>
Date 2011-07-10 19:00 -0400
Newsgroups comp.lang.python
Message-ID <mailman.858.1310339158.1164.python-list@python.org> (permalink)

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

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():
    """I am a docstring"""
    pass

def bar():
    ds = "I am not a docstring!"

def baz():
    "I am a docstring too!"
    pass

def qux():
    'And even me! Quote type don't matter (besides style)'
     pass
-- 
Corey Richardson
  "Those who deny freedom to others, deserve it not for themselves"
     -- Abraham Lincoln

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


Thread

Function docstring as a local variable Tim Johnson <tim@johnsons-web.com> - 2011-07-10 09:41 -0800
  Re: Function docstring as a local variable rantingrick <rantingrick@gmail.com> - 2011-07-10 10:44 -0700
    Re: Function docstring as a local variable "Colin J. Williams" <cjw@ncf.ca> - 2011-07-10 18:28 -0400
      Re: Function docstring as a local variable Ben Finney <ben+python@benfinney.id.au> - 2011-07-11 09:48 +1000
    Re: Function docstring as a local variable Corey Richardson <kb1pkl@aim.com> - 2011-07-10 19:00 -0400
      Re: Function docstring as a local variable Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-07-11 11:54 +1000
      Re: Function docstring as a local variable alex23 <wuwei23@gmail.com> - 2011-07-10 21:05 -0700

csiph-web