Steven D'Aprano added the comment:

A function like this often gets called to truncate lots of lines. Unfortunately 
for many use-cases, the part truncated is the most significant part of the 
line. E.g.:

Scanning file:
/home/fred/documents/datafil...
/home/fred/documents/datafil...
/home/fred/documents/datafil...
/home/fred/documents/datafil...


It's often better in cases like this to truncate in the middle:

Scanning file:
/home/fred/doc...datafile01.txt
/home/fred/doc...datafile02.txt
/home/fred/doc...datafile03.txt
/home/fred/doc...datafile04.txt

(I believe Mac OS-X routinely truncates long lines in the middle in this way.)

Perhaps there could be an argument controlling where to truncate (left, right 
or centre). A good use-case for the new Enums, perhaps? :-)

----------
nosy: +stevenjd

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue18585>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to