summaryrefslogtreecommitdiffstats
path: root/Lib/stringold.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1992-09-20 21:41:09 (GMT)
committerGuido van Rossum <guido@python.org>1992-09-20 21:41:09 (GMT)
commit7a461e5aaf011243d9ac2658e4172e316b031eb9 (patch)
treea333855142b647a2ca74f5ee84e1d66c11754542 /Lib/stringold.py
parent7066dd75c5ee8385135541d03fb8edd8939ad740 (diff)
downloadcpython-7a461e5aaf011243d9ac2658e4172e316b031eb9.zip
cpython-7a461e5aaf011243d9ac2658e4172e316b031eb9.tar.gz
cpython-7a461e5aaf011243d9ac2658e4172e316b031eb9.tar.bz2
New module regsub contains sub(), gsub() and split() as in nawk.
string.splitfields(s, '') now returns [s] as split() in nawk. Added _exit to exported functions of os.
Diffstat (limited to 'Lib/stringold.py')
-rw-r--r--Lib/stringold.py5
1 files changed, 2 insertions, 3 deletions
diff --git a/Lib/stringold.py b/Lib/stringold.py
index f358ac4..6386a95 100644
--- a/Lib/stringold.py
+++ b/Lib/stringold.py
@@ -63,13 +63,12 @@ def split(s):
# Split a list into fields separated by a given string
# NB: splitfields(s, ' ') is NOT the same as split(s)!
-# splitfields(s, '') is illegal
-splitfields_error = 'string.splitfields called with empty separator'
+# splitfields(s, '') returns [s] (in analogy with split() in nawk)
def splitfields(s, sep):
res = []
nsep = len(sep)
if nsep == 0:
- raise splitfields_error
+ return [s]
ns = len(s)
i = j = 0
while j+nsep <= ns: