[Python-checkins] python/dist/src/Lib textwrap.py, 1.32.8.1, 1.32.8.2

gward at users.sourceforge.net gward at users.sourceforge.net
Wed May 12 21:48:18 EDT 2004


Update of /cvsroot/python/python/dist/src/Lib
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4211/Lib

Modified Files:
      Tag: release23-maint
	textwrap.py 
Log Message:
SF #847346: remove misguided optimization for short input from
wrap() method.  Premature optimization is indeed the root of all evil.
Whitespace fix.


Index: textwrap.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/textwrap.py,v
retrieving revision 1.32.8.1
retrieving revision 1.32.8.2
diff -C2 -d -r1.32.8.1 -r1.32.8.2
*** textwrap.py	30 Aug 2003 14:52:35 -0000	1.32.8.1
--- textwrap.py	13 May 2004 01:48:15 -0000	1.32.8.2
***************
*** 91,102 ****
  
  
!     def __init__ (self,
!                   width=70,
!                   initial_indent="",
!                   subsequent_indent="",
!                   expand_tabs=True,
!                   replace_whitespace=True,
!                   fix_sentence_endings=False,
!                   break_long_words=True):
          self.width = width
          self.initial_indent = initial_indent
--- 91,102 ----
  
  
!     def __init__(self,
!                  width=70,
!                  initial_indent="",
!                  subsequent_indent="",
!                  expand_tabs=True,
!                  replace_whitespace=True,
!                  fix_sentence_endings=False,
!                  break_long_words=True):
          self.width = width
          self.initial_indent = initial_indent
***************
*** 269,274 ****
          text = self._munge_whitespace(text)
          indent = self.initial_indent
-         if len(text) + len(indent) <= self.width:
-             return [indent + text]
          chunks = self._split(text)
          if self.fix_sentence_endings:
--- 269,272 ----




More information about the Python-checkins mailing list