Python: Docstrings are not being updated
Question: I have a docstring on the very first line of a Python file called a_file.py:

    
    
    """some text"""
    

When I print this using

    
    
    import a_file
    print a_file.__doc__
    

it prints `some text` as exptected. However, whenever I change the docstring
to

    
    
    """different text"""
    

it still prints `some text`. I have made sure the file was saved with the
changes. I have a feeling that there is something very simple that I am just
overlooking. Any help would be greatly appreciated. I have read over the
[python page on docstrings](http://www.python.org/dev/peps/pep-0257/) but
still no luck.

EDIT: SOLVED - I have figured it out. Basically, I have a makefile which
creates a new file. I was printing from the new file when I thought I was
actually printing from the source file. When I re-ran the makefile with the
edited text, all was well.


Answer: Are you editing the module's doctstring ? If so, you'll need to reimport the
file as its docstring is now in the memory. Use
[reload](http://docs.python.org/2/library/functions.html#reload) for this If
not, this code works:

    
    
    >>> def a():
    ...     """ hello """
    ...     print 'aa'
    ... 
    >>> a.__doc__
    ' hello '
    >>> a.__doc__ = 'bla bla'
    >>> a.__doc__
    'bla bla'
    

