Menu

#271 Doctest Blocks interpret backslash (\)

closed-works-for-me
5
2008-03-24
2008-03-24
Anonymous
No

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

Discussion

  • Edward Loper

    Edward Loper - 2008-03-24

    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.

     
  • Edward Loper

    Edward Loper - 2008-03-24
    • status: open --> closed-works-for-me
     

Log in to post a comment.