diff options
author | Barry Warsaw <barry@python.org> | 2002-06-01 05:49:17 (GMT) |
---|---|---|
committer | Barry Warsaw <barry@python.org> | 2002-06-01 05:49:17 (GMT) |
commit | 1c30aa2292d244026afc8bf36455ef12deb0760a (patch) | |
tree | 193447b7c9bee9a07cff48652c2e808045099ff9 | |
parent | c5d1c045ab68823db53f44a1021225b78d2d0b04 (diff) | |
download | cpython-1c30aa2292d244026afc8bf36455ef12deb0760a.zip cpython-1c30aa2292d244026afc8bf36455ef12deb0760a.tar.gz cpython-1c30aa2292d244026afc8bf36455ef12deb0760a.tar.bz2 |
The _compat modules now export _floordiv() instead of _intdiv2() for
better code reuse.
_split() Use _floordiv().
-rw-r--r-- | Lib/email/Header.py | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/Lib/email/Header.py b/Lib/email/Header.py index 95b5a37..714839e 100644 --- a/Lib/email/Header.py +++ b/Lib/email/Header.py @@ -9,10 +9,10 @@ import email.base64MIME from email.Charset import Charset try: - from email._compat22 import _intdiv2 + from email._compat22 import _floordiv except SyntaxError: # Python 2.1 spells integer division differently - from email._compat21 import _intdiv2 + from email._compat21 import _floordiv CRLFSPACE = '\r\n ' CRLF = '\r\n' @@ -168,9 +168,8 @@ class Header: last = charset.from_splittable(splittable[splitpnt:], 0) return self._split(first, charset) + self._split(last, charset) else: - # Divide and conquer. BAW: halfway depends on integer division. - # When porting to Python 2.2, use the // operator. - halfway = _intdiv2(len(splittable)) + # Divide and conquer. + halfway = _floordiv(len(splittable), 2) first = charset.from_splittable(splittable[:halfway], 0) last = charset.from_splittable(splittable[halfway:], 0) return self._split(first, charset) + self._split(last, charset) |