[Python-checkins] python/dist/src/Lib UserString.py,1.10,1.10.18.1

anthonybaxter@sourceforge.net anthonybaxter@sourceforge.net
Wed, 17 Apr 2002 22:17:55 -0700


Update of /cvsroot/python/python/dist/src/Lib
In directory usw-pr-cvs1:/tmp/cvs-serv13404/Lib

Modified Files:
      Tag: release22-maint
	UserString.py 
Log Message:
backport gvanrossum's patch:

Partially implement SF feature request 444708.

Add optional arg to string methods strip(), lstrip(), rstrip().
The optional arg specifies characters to delete.

Also for UserString.

Still to do:

- Misc/NEWS
- LaTeX docs (I did the docstrings though)
- Unicode methods, and Unicode support in the string methods.

Original patches were:
python/dist/src/Lib/UserString.py:1.11


Index: UserString.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/UserString.py,v
retrieving revision 1.10
retrieving revision 1.10.18.1
diff -C2 -d -r1.10 -r1.10.18.1
*** UserString.py	15 May 2001 11:58:05 -0000	1.10
--- UserString.py	18 Apr 2002 05:17:53 -0000	1.10.18.1
***************
*** 109,113 ****
      def ljust(self, width): return self.__class__(self.data.ljust(width))
      def lower(self): return self.__class__(self.data.lower())
!     def lstrip(self): return self.__class__(self.data.lstrip())
      def replace(self, old, new, maxsplit=-1):
          return self.__class__(self.data.replace(old, new, maxsplit))
--- 109,113 ----
      def ljust(self, width): return self.__class__(self.data.ljust(width))
      def lower(self): return self.__class__(self.data.lower())
!     def lstrip(self, sep=None): return self.__class__(self.data.lstrip(sep))
      def replace(self, old, new, maxsplit=-1):
          return self.__class__(self.data.replace(old, new, maxsplit))
***************
*** 117,121 ****
          return self.data.rindex(sub, start, end)
      def rjust(self, width): return self.__class__(self.data.rjust(width))
!     def rstrip(self): return self.__class__(self.data.rstrip())
      def split(self, sep=None, maxsplit=-1):
          return self.data.split(sep, maxsplit)
--- 117,121 ----
          return self.data.rindex(sub, start, end)
      def rjust(self, width): return self.__class__(self.data.rjust(width))
!     def rstrip(self, sep=None): return self.__class__(self.data.rstrip(sep))
      def split(self, sep=None, maxsplit=-1):
          return self.data.split(sep, maxsplit)
***************
*** 123,127 ****
      def startswith(self, prefix, start=0, end=sys.maxint):
          return self.data.startswith(prefix, start, end)
!     def strip(self): return self.__class__(self.data.strip())
      def swapcase(self): return self.__class__(self.data.swapcase())
      def title(self): return self.__class__(self.data.title())
--- 123,127 ----
      def startswith(self, prefix, start=0, end=sys.maxint):
          return self.data.startswith(prefix, start, end)
!     def strip(self, sep=None): return self.__class__(self.data.strip(sep))
      def swapcase(self): return self.__class__(self.data.swapcase())
      def title(self): return self.__class__(self.data.title())