]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Removed *.libs (now in ./sgi);
authorGuido van Rossum <guido@python.org>
Thu, 6 Aug 1992 22:33:41 +0000 (22:33 +0000)
committerGuido van Rossum <guido@python.org>
Thu, 6 Aug 1992 22:33:41 +0000 (22:33 +0000)
added gettext() method to TextEdit.py;
fixed string.atoi() to ignore leading zeros.

Lib/lib-stdwin/TextEdit.py
Lib/stdwin/TextEdit.py
Lib/string.py
Lib/stringold.py

index 540692ce2431498ba97d1c7cab9a3de77b7dc5e1..698a7d5ca67a5603499fd709eecf7cf2ae301f0d 100644 (file)
@@ -27,6 +27,9 @@ class TextEdit:
        def settext(self, text):
                self.editor.settext(text)
        #
+       def gettext(self):
+               return self.editor.gettext(text)
+       #
        # Downcalls from parent to child
        #
        def destroy(self):
index 540692ce2431498ba97d1c7cab9a3de77b7dc5e1..698a7d5ca67a5603499fd709eecf7cf2ae301f0d 100755 (executable)
@@ -27,6 +27,9 @@ class TextEdit:
        def settext(self, text):
                self.editor.settext(text)
        #
+       def gettext(self):
+               return self.editor.gettext(text)
+       #
        # Downcalls from parent to child
        #
        def destroy(self):
index cfb977fcc3f1f2f9e6fda571f375ca37f81fb93b..94e91570c5c70915556a6cb69c46402011b766e0 100644 (file)
@@ -102,12 +102,16 @@ def index(s, sub):
 # Convert string to integer
 atoi_error = 'non-numeric argument to string.atoi'
 def atoi(str):
+       sign = ''
        s = str
-       if s[:1] in '+-': s = s[1:]
+       if s[:1] in '+-':
+               sign = s[0]
+               s = s[1:]
        if not s: raise atoi_error, str
+       while s[0] == '0' and len(s) > 1: s = s[1:]
        for c in s:
                if c not in digits: raise atoi_error, str
-       return eval(str)
+       return eval(sign + s)
 
 # Left-justify a string
 def ljust(s, width):
index cfb977fcc3f1f2f9e6fda571f375ca37f81fb93b..94e91570c5c70915556a6cb69c46402011b766e0 100644 (file)
@@ -102,12 +102,16 @@ def index(s, sub):
 # Convert string to integer
 atoi_error = 'non-numeric argument to string.atoi'
 def atoi(str):
+       sign = ''
        s = str
-       if s[:1] in '+-': s = s[1:]
+       if s[:1] in '+-':
+               sign = s[0]
+               s = s[1:]
        if not s: raise atoi_error, str
+       while s[0] == '0' and len(s) > 1: s = s[1:]
        for c in s:
                if c not in digits: raise atoi_error, str
-       return eval(str)
+       return eval(sign + s)
 
 # Left-justify a string
 def ljust(s, width):