summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1992-08-06 22:33:41 (GMT)
committerGuido van Rossum <guido@python.org>1992-08-06 22:33:41 (GMT)
commit2d4aa4f5d43842bc049752ab8d5ffa3d2880cbe6 (patch)
treee29f64650143fa734fd2b9f29029f2d88e7ba530
parentde126a6ff8d3ac2432ca2e117d269916041203ad (diff)
downloadcpython-2d4aa4f5d43842bc049752ab8d5ffa3d2880cbe6.zip
cpython-2d4aa4f5d43842bc049752ab8d5ffa3d2880cbe6.tar.gz
cpython-2d4aa4f5d43842bc049752ab8d5ffa3d2880cbe6.tar.bz2
Removed *.libs (now in ./sgi);
added gettext() method to TextEdit.py; fixed string.atoi() to ignore leading zeros.
-rw-r--r--Lib/lib-stdwin/TextEdit.py3
-rwxr-xr-xLib/stdwin/TextEdit.py3
-rw-r--r--Lib/string.py8
-rw-r--r--Lib/stringold.py8
4 files changed, 18 insertions, 4 deletions
diff --git a/Lib/lib-stdwin/TextEdit.py b/Lib/lib-stdwin/TextEdit.py
index 540692c..698a7d5 100644
--- a/Lib/lib-stdwin/TextEdit.py
+++ b/Lib/lib-stdwin/TextEdit.py
@@ -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):
diff --git a/Lib/stdwin/TextEdit.py b/Lib/stdwin/TextEdit.py
index 540692c..698a7d5 100755
--- a/Lib/stdwin/TextEdit.py
+++ b/Lib/stdwin/TextEdit.py
@@ -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):
diff --git a/Lib/string.py b/Lib/string.py
index cfb977f..94e9157 100644
--- a/Lib/string.py
+++ b/Lib/string.py
@@ -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):
diff --git a/Lib/stringold.py b/Lib/stringold.py
index cfb977f..94e9157 100644
--- a/Lib/stringold.py
+++ b/Lib/stringold.py
@@ -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):