New submission from Tyler Romeo <tylerro...@gmail.com>: Python's textwrap module can be helpful at times, but personally I think there are a couple of things that could be added.
First, when it comes to text wrapping, usually you're not dealing with a monospace font where each letter is the same size. If you're working with the Python Imaging Library for example, there is a function that you pass the text to in order to determine how wide (or tall) a font is. Therefore, it would be useful to have a parameter where the user can pass a function that gives a custom width for a set of text. The default for this parameter, of course, would be len. Also, this module uses a rough and efficient algorithm for wrapping text, but the results are not always aesthetically pleasing (one word hanging off on a line). Sometimes the user may want something that is wrapped more beautifully, so to say, such as is found in TeX. So there should also be a beautiful option that goes back and redistributes the text so that it is more aesthetically pleasing. This isn't exactly that important (minor improvements to a module that is probably not used much), but I figured I'd get it out there as I run into the problem all the time when trying to wrap text to be put in images of a set size. ---------- components: Extension Modules files: textwrap.py-improvement.diff keywords: patch messages: 139731 nosy: parent5446 priority: normal severity: normal status: open title: Improvement of textwrap module type: feature request versions: Python 2.7 Added file: http://bugs.python.org/file22561/textwrap.py-improvement.diff _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue12485> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com