[issue18585] Add a text truncation function

Antoine Pitrou report at bugs.python.org
Mon Aug 5 20:36:11 CEST 2013


Antoine Pitrou added the comment:

> Looking just at the proposed functionality (taking a prefix) and
> ignoring the requested complexification :), the usual name for the
> text produced by this process is a
> "lead" (http://en.wikipedia.org/wiki/Wikipedia:Manual_of_Style/Lead_section), although formally a lead is actually written to be used as such, as opposed to just taking a prefix, so that word really has the same problem as 'summarize'.

Good point.

> The placeholder argument could alternatively be named 'ellipsis', but
> placeholder is certainly fine.

I would certainly like ellipsis if it didn't already mean something else
in Python.

> shorten would probably be better if you are going with the expanded
> version, but I like truncate.  It is probably significant that that is
> what the title of the issue calls it :)

I'm a bit negative towards truncate(), mostly because I've worked on the
I/O stack and truncate means something much less careful there (e.g.
StringIO.truncate()).
But really, I'm fine with either shorten() or truncate(). I agree
summarize() may try to look a bit too smart.

----------

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


More information about the Python-bugs-list mailing list