diff options
author | Georg Brandl <georg@python.org> | 2008-03-23 08:05:30 (GMT) |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2008-03-23 08:05:30 (GMT) |
commit | 61854332b932d1d561fc58f815056d008e86ddd3 (patch) | |
tree | 74fbc80533ce4535a9c7abb31d6c4acc39560e87 /Doc | |
parent | ade57d048527f35a6086040a14a0e7184faa91ce (diff) | |
download | cpython-61854332b932d1d561fc58f815056d008e86ddd3.zip cpython-61854332b932d1d561fc58f815056d008e86ddd3.tar.gz cpython-61854332b932d1d561fc58f815056d008e86ddd3.tar.bz2 |
Make the doctests presentation-friendlier.
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/library/operator.rst | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/Doc/library/operator.rst b/Doc/library/operator.rst index a2329e8..023bb74 100644 --- a/Doc/library/operator.rst +++ b/Doc/library/operator.rst @@ -6,6 +6,11 @@ .. sectionauthor:: Skip Montanaro <skip@automatrix.com> +.. testsetup:: + + import operator + from operator import itemgetter + The :mod:`operator` module exports a set of functions implemented in C corresponding to the intrinsic operators of Python. For example, @@ -481,12 +486,10 @@ objects. Example: Build a dictionary that maps the ordinals from ``0`` to ``255`` to their character equivalents. - >>> import operator >>> d = {} >>> keys = range(256) >>> vals = map(chr, keys) - >>> map(operator.setitem, [d]*len(keys), keys, vals) - [None, None, ..., None] + >>> map(operator.setitem, [d]*len(keys), keys, vals) # doctest: +SKIP .. XXX: find a better, readable, example @@ -536,7 +539,6 @@ expect a function argument. method. Dictionaries accept any hashable value. Lists, tuples, and strings accept an index or a slice: - >>> from operator import itemgetter >>> itemgetter(1)('ABCDEFG') 'B' >>> itemgetter(1,3,5)('ABCDEFG') |