Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(94982)

#18585: Add a text truncation function

Can't Edit
Can't Publish+Mail
Start Review
Created:
6 years ago by pitrou
Modified:
6 years ago
Reviewers:
ezio.melotti, rdmurray, storchaka
CC:
barry, Georg, AntoinePitrou, ezio.melotti, stevenjd, r.david.murray, dholth, devnull_psf.upfronthosting.co.za, storchaka, vajrasky
Visibility:
Public.

Patch Set 1 #

Patch Set 2 #

Patch Set 3 #

Total comments: 17

Patch Set 4 #

Total comments: 4
Unified diffs Side-by-side diffs Delta from patch set Stats Patch
Doc/library/textwrap.rst View 1 2 3 4 chunks +43 lines, -10 lines 0 comments Download
Lib/test/test_textwrap.py View 1 2 3 3 chunks +59 lines, -9 lines 0 comments Download
Lib/textwrap.py View 1 2 3 5 chunks +51 lines, -2 lines 4 comments Download

Messages

Total messages: 8
ezio.melotti
http://bugs.python.org/review/18585/diff/8897/Doc/library/textwrap.rst File Doc/library/textwrap.rst (right): http://bugs.python.org/review/18585/diff/8897/Doc/library/textwrap.rst#newcode14 Doc/library/textwrap.rst:14: :func:`wrap`, :func:`fill` and :func:`shorten|, as well as s/\|/`/ http://bugs.python.org/review/18585/diff/8897/Doc/library/textwrap.rst#newcode45 ...
6 years ago #1
AntoinePitrou
http://bugs.python.org/review/18585/diff/8897/Doc/library/textwrap.rst File Doc/library/textwrap.rst (right): http://bugs.python.org/review/18585/diff/8897/Doc/library/textwrap.rst#newcode45 Doc/library/textwrap.rst:45: .. function:: shorten(text, width=70, *, placeholder=" (...)") On 2013/08/12 ...
6 years ago #2
r.david.murray
http://bugs.python.org/review/18585/diff/8897/Doc/library/textwrap.rst File Doc/library/textwrap.rst (right): http://bugs.python.org/review/18585/diff/8897/Doc/library/textwrap.rst#newcode15 Doc/library/textwrap.rst:15: :class:`TextWrapper`, the class that does all the work, and ...
6 years ago #3
AntoinePitrou
http://bugs.python.org/review/18585/diff/8897/Doc/library/textwrap.rst File Doc/library/textwrap.rst (right): http://bugs.python.org/review/18585/diff/8897/Doc/library/textwrap.rst#newcode45 Doc/library/textwrap.rst:45: .. function:: shorten(text, width=70, *, placeholder=" (...)") On 2013/08/12 ...
6 years ago #4
AntoinePitrou
http://bugs.python.org/review/18585/diff/8897/Doc/library/textwrap.rst File Doc/library/textwrap.rst (right): http://bugs.python.org/review/18585/diff/8897/Doc/library/textwrap.rst#newcode51 Doc/library/textwrap.rst:51: as possible are joined and then the *placeholder* is ...
6 years ago #5
r.david.murray
On 2013/08/12 22:32:45, AntoinePitrou wrote: > http://bugs.python.org/review/18585/diff/8897/Doc/library/textwrap.rst > File Doc/library/textwrap.rst (right): > > http://bugs.python.org/review/18585/diff/8897/Doc/library/textwrap.rst#newcode51 > ...
6 years ago #6
storchaka_gmail.com
http://bugs.python.org/review/18585/diff/8903/Lib/textwrap.py File Lib/textwrap.py (right): http://bugs.python.org/review/18585/diff/8903/Lib/textwrap.py#newcode316 Lib/textwrap.py:316: max_length = self.width Fast path: if len(text) <= max_length: ...
6 years ago #7
AntoinePitrou
6 years ago #8
http://bugs.python.org/review/18585/diff/8903/Lib/textwrap.py
File Lib/textwrap.py (right):

http://bugs.python.org/review/18585/diff/8903/Lib/textwrap.py#newcode316
Lib/textwrap.py:316: max_length = self.width
On 2013/08/12 22:54:32, storchaka wrote:
> Fast path:
> 
> if len(text) <= max_length:
>     return ' '.join(text.strip().split()) # or something like

At this point I'm gonna decide that anyone who wants to optimize the code can do
it in a separate issue :-)
Sign in to reply to this message.

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+