STINNER Victor <[email protected]> added the comment:
Should we add imports in all examples? Eg. add import math in:
>>> repr(math.pi)
'3.141592653589793'
>>> str(math.pi)
'3.141592653589793'
At least, accumulate should be replaced by itertools.accumulate in the
following example:
>>> list(accumulate(8, 2, 50))
[8, 10, 60]
Because it looks like accumulate() is a builtin function.
Some other examples without the module name: "tally = Counter(dogs=5, cat=3)",
"d = OrderedDict...", "d = deque('simsalabim')", "all_polls_closed =
Barrier(len(sites))", ...
I prefer to have the module name in examples because it is easy to test them:
just copy/paste in an interpreter. It's even more easier if there is the import
statement :-)
----------
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue11071>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com