Dear Tutors and fellow pythonistas,
I would like to get access to the private methods of my function.

For instance:
Who can I reference the docstring of a function within the function itself?

Please have a look at the code below and assist me.

Thanks and regards,
Timmie

#### CODE ###

s = 'hello'

def show(str):
    """prints str"""
    print str

    return str



def show2(str):
        """prints str"""
        print str
        d = self.__doc__
        print d

>>> show2(s)
hello
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)

<ipython console> in <module>()

<ipython console> in show2(str)

NameError: global name 'self' is not defined

_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to