New submission from Larry Hastings <la...@hastings.org>: Two minor tweaks to unicode_repeat: * If the number of repeats (len) is < 1, we're always going to return the empty Unicode string. So I incr and return unicode_empty. * The current code has "if (done < nchars)" around the first copy. A little data-flow analysis of the code will show you that done is always 0 and nchars is always >= str->length. So the check is unnecessary--we're always going to do that first copy. I removed the if and set done to str->length directly.
Hope I got it right! ---------- components: Interpreter Core files: lch.unicoderepeat.r71304.diff keywords: patch messages: 85620 nosy: lhastings severity: normal status: open title: Tiny code polishing to unicode_repeat versions: Python 3.1 Added file: http://bugs.python.org/file13627/lch.unicoderepeat.r71304.diff _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue5708> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com