[New-bugs-announce] [issue12148] Clarify "or-ing together" doctest option flags

ekorn report at bugs.python.org
Sun May 22 12:09:26 CEST 2011


New submission from ekorn <jonovik at gmail.com>:

Combining multiple option flags to doctest.testmod(optionflags=...) requires the bitwise or operator |, not plain "or". I therefore suggest rewording "or-ing together individual option flags." to "or-ing together individual option flags, using the 'bitwise or' operator |.", perhaps with a link to http://docs.python.org/reference/expressions.html#binary-bitwise-operations.

Example:

"""
Doctest option flags must be or-ed together with '|', not 'or'.

>>> print "A  B  C"
A B...
"""
import doctest

print "Combining option flags using bitwise '|'..."
doctest.testmod(optionflags=doctest.NORMALIZE_WHITESPACE | doctest.ELLIPSIS)
print "Combining option flags using logical 'or'..."
doctest.testmod(optionflags=doctest.NORMALIZE_WHITESPACE or doctest.ELLIPSIS)

----------
assignee: docs at python
components: Documentation
messages: 136509
nosy: docs at python, ekorn
priority: normal
severity: normal
status: open
title: Clarify "or-ing together" doctest option flags
versions: Python 2.7

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue12148>
_______________________________________


More information about the New-bugs-announce mailing list