Serhiy Storchaka added the comment:
I think breaking the compatibility should be discussed on Python-Dev. Similar issue (and even worse) is issue8934.
----------
nosy: +serhiy.storchaka
_______________________________________
Python tracker <report(a)bugs.python.org>
<http://bugs.python.org/issue21071>
_______________________________________
Martin Panter added the comment:
Here is a patch that changes over to a str() type.
Is it safe to assume PyUnicode_AsUTF8() is null-terminated (like PyBytes_AS_STRING() is)? My documentation doesn’t say.
----------
Added file: http://bugs.python.org/file37488/format-str.patch
_______________________________________
Python tracker <report(a)bugs.python.org>
<http://bugs.python.org/issue21071>
_______________________________________
Martin Panter added the comment:
I included the proposed doc fix in my patch for Issue 19548
----------
nosy: +vadmium
_______________________________________
Python tracker <report(a)bugs.python.org>
<http://bugs.python.org/issue19539>
_______________________________________
New submission from bbc:
The documentation page for the cmd module contains an example with the turtle module:
https://docs.python.org/3.4/library/cmd.html#cmd-example
It seems like the turtle module has changed quite a bit since the code was written, and exposes a Pen class instead of all the various movement functions. The example, while still useful, cannot be executed as is.
I like the example and would be happy to provide an idiomatic replacement if you think this is necessary.
----------
assignee: docs@python
components: Documentation
messages: 232829
nosy: bbc, docs@python
priority: normal
severity: normal
status: open
title: Broken turtle example in Cmd documentation
type: behavior
versions: Python 3.4
_______________________________________
Python tracker <report(a)bugs.python.org>
<http://bugs.python.org/issue23073>
_______________________________________
Martin Panter added the comment:
I originally assumed it would be a text string from the existing documentation, so changing the behaviour to match also seems reasonable
----------
_______________________________________
Python tracker <report(a)bugs.python.org>
<http://bugs.python.org/issue21071>
_______________________________________
STINNER Victor added the comment:
> It would be backwards incompatible to change, though.
I'm in favor of breaking the compatibility with Python 3.4 and return the format as an Unicode string.
----------
nosy: +haypo
_______________________________________
Python tracker <report(a)bugs.python.org>
<http://bugs.python.org/issue21071>
_______________________________________
I am experimenting with Python step by step. The very first step in the Python for Dummies is >>>Print. This gives me an error message. Any command of print gives an error.
New submission from Ross Burnett:
In section "3.1.2. Strings" of the Tutorial (version 3.4 plus others?), a comment on a slicing error has an error:
"word[42] # the word only has 7 characters"
It should say "word[42] # the word has 6 characters"
----------
assignee: docs@python
components: Documentation
messages: 232795
nosy: docs@python, rossburnett
priority: normal
severity: normal
status: open
title: Error in Tutorial comment
versions: Python 3.4
_______________________________________
Python tracker <report(a)bugs.python.org>
<http://bugs.python.org/issue23070>
_______________________________________
New submission from Terry J. Reedy:
from functools import reduce
def add(a,b): return a+b
reduce(add, {})
>>>
Traceback (most recent call last):
File "C:\Programs\Python34\tem.py", line 3, in <module>
reduce(add, {})
TypeError: reduce() of empty sequence with no initial value
However, the reduce-equivalent code in the doc sets a bad example and forgets to account for empty iterators.
def reduce(function, iterable, initializer=None):
it = iter(iterable)
if initializer is None:
value = next(it)
else: ...
So it lets the StopIteration escape (a bad practice that can silently break iterators). The code should be
def reduce(function, iterable, initializer=None):
it = iter(iterable)
if initializer is None:
try:
value = next(it)
except StopIteration:
raise TypeError("reduce() of empty sequence with no initial value") from None
else: ...
(patch coming)
----------
assignee: docs@python
components: Documentation, Interpreter Core
messages: 232626
nosy: docs@python, terry.reedy
priority: normal
severity: normal
stage: needs patch
status: open
title: Fix functools.reduce code equivalent.
type: behavior
versions: Python 3.4, Python 3.5
_______________________________________
Python tracker <report(a)bugs.python.org>
<http://bugs.python.org/issue23049>
_______________________________________