[Python-checkins] CVS: python/dist/src/Lib string.py,1.47,1.48

Guido van Rossum guido@cnri.reston.va.us
Fri, 10 Mar 2000 18:22:13 -0500 (EST)


Update of /projects/cvsroot/python/dist/src/Lib
In directory eric:/home/guido/hp/mal/py-patched/Lib

Modified Files:
	string.py 
Log Message:
Marc-Andre Lemburg: the maxsplit argument for split() and replace()
now defaults to -1, not to 0.  Passing an explicit zero doesn't split
or replace at all.


Index: string.py
===================================================================
RCS file: /projects/cvsroot/python/dist/src/Lib/string.py,v
retrieving revision 1.47
retrieving revision 1.48
diff -C2 -r1.47 -r1.48
*** string.py	2000/02/10 16:21:11	1.47
--- string.py	2000/03/10 23:22:10	1.48
***************
*** 98,108 ****
  # Split a string into a list of space/tab-separated words
  # NB: split(s) is NOT the same as splitfields(s, ' ')!
! def split(s, sep=None, maxsplit=0):
      """split(s [,sep [,maxsplit]]) -> list of strings
  
      Return a list of the words in the string s, using sep as the
!     delimiter string.  If maxsplit is nonzero, splits into at most
      maxsplit words.  If sep is not specified, any whitespace string
!     is a separator.  Maxsplit defaults to 0.
  
      (split and splitfields are synonymous)
--- 98,108 ----
  # Split a string into a list of space/tab-separated words
  # NB: split(s) is NOT the same as splitfields(s, ' ')!
! def split(s, sep=None, maxsplit=-1):
      """split(s [,sep [,maxsplit]]) -> list of strings
  
      Return a list of the words in the string s, using sep as the
!     delimiter string.  If maxsplit is given, splits into at most
      maxsplit words.  If sep is not specified, any whitespace string
!     is a separator.
  
      (split and splitfields are synonymous)
***************
*** 397,401 ****
  
  # Substring replacement (global)
! def replace(s, old, new, maxsplit=0):
      """replace (str, old, new[, maxsplit]) -> string
  
--- 397,401 ----
  
  # Substring replacement (global)
! def replace(s, old, new, maxsplit=-1):
      """replace (str, old, new[, maxsplit]) -> string