Documentation string

f_beutlin at hotmail.com f_beutlin at hotmail.com
Thu Aug 26 14:44:34 CEST 1999


In article <7q3c88$k8m$1 at nnrp1.deja.com>,
  sp00fD <sp00fD at yahoo.com> wrote:
> Can someone tell me why the
>
> def foo(self):
> """A method"""
>
> won't work?
>
> $ ./rcopy.py -p BACKUP ./foo /tmp
>   File "./rcopy.py", line 18
>     """A method"""
>                  ^
> SyntaxError: invalid syntax

The problem is simple and easily fixed: the comment is not indented. Try
indenting it, and it'll work (indentation will make the comment part of
the method or function; starting it at the same indentation level as
"def" will make it a new and incorrect command outside the function).

Python-professionals: please forgive me if I'm wrong; I'm new to Python
myself.

Regards

Joerg


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.




More information about the Python-list mailing list