Doctest Blocks interpret backslash (\)
Brought to you by:
edloper
In the following Doctest block the backslashes are interpreted by epydoc:
>>> def noToneApostropheRule(precedingEntity, followingEntity):
... return precedingEntity and precedingEntity[0].isalpha() \
... and not precedingEntity[-1].isdigit() \
... and followingEntity[0].isalpha()
This results in all content being printed on one line in HTML output:
>>> def noToneApostropheRule(precedingEntity, followingEntity):
... return precedingEntity and precedingEntity[0].isalpha() ... and not precedingEntity[-1].isdigit() ... and followingEntity[0].isalpha()
Not knowing if this is a bug or a feature it seems impossible to actually tell epydoc to keep the <pre> block short.
chrislb at gmx dot de
Logged In: YES
user_id=195958
Originator: NO
This is python's behavior, not epydoc's -- it's basically the same issue described here:
http://epydoc.sourceforge.net/faq.html#backslash
I.e., docstrings are really python strings; you can see this if you print myfunc.__doc__. If you want backslashes to be preserved, then you need to use a raw string, just like you would any other time you have a string value and want backslashes to be preserved.