summaryrefslogtreecommitdiffstats
path: root/Lib/locale.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1998-03-26 21:13:24 (GMT)
committerGuido van Rossum <guido@python.org>1998-03-26 21:13:24 (GMT)
commit45e2fbc2e70ef28b1f0327207f33dab3a4e825c5 (patch)
tree24cafdb6ffb07170188292a02440935291327cde /Lib/locale.py
parent9ea7024754f0e42d7fc70fd1c8f6f6cfbf7e1cf0 (diff)
downloadcpython-45e2fbc2e70ef28b1f0327207f33dab3a4e825c5.zip
cpython-45e2fbc2e70ef28b1f0327207f33dab3a4e825c5.tar.gz
cpython-45e2fbc2e70ef28b1f0327207f33dab3a4e825c5.tar.bz2
Mass check-in after untabifying all files that need it.
Diffstat (limited to 'Lib/locale.py')
-rw-r--r--Lib/locale.py36
1 files changed, 18 insertions, 18 deletions
diff --git a/Lib/locale.py b/Lib/locale.py
index 6246fd9..d85cabf 100644
--- a/Lib/locale.py
+++ b/Lib/locale.py
@@ -11,21 +11,21 @@ def _group(s):
if not grouping:return s
result=""
while s and grouping:
- # if grouping is -1, we are done
- if grouping[0]==CHAR_MAX:
- break
- # 0: re-use last group ad infinitum
- elif grouping[0]!=0:
- #process last group
- group=grouping[0]
- grouping=grouping[1:]
- if result:
- result=s[-group:]+conv['thousands_sep']+result
- else:
- result=s[-group:]
- s=s[:-group]
+ # if grouping is -1, we are done
+ if grouping[0]==CHAR_MAX:
+ break
+ # 0: re-use last group ad infinitum
+ elif grouping[0]!=0:
+ #process last group
+ group=grouping[0]
+ grouping=grouping[1:]
+ if result:
+ result=s[-group:]+conv['thousands_sep']+result
+ else:
+ result=s[-group:]
+ s=s[:-group]
if s and result:
- result=s+conv['thousands_sep']+result
+ result=s+conv['thousands_sep']+result
return result
def format(f,val,grouping=0):
@@ -35,13 +35,13 @@ def format(f,val,grouping=0):
result = f % val
fields = string.splitfields(result,".")
if grouping:
- fields[0]=_group(fields[0])
+ fields[0]=_group(fields[0])
if len(fields)==2:
- return fields[0]+localeconv()['decimal_point']+fields[1]
+ return fields[0]+localeconv()['decimal_point']+fields[1]
elif len(fields)==1:
- return fields[0]
+ return fields[0]
else:
- raise Error,"Too many decimal points in result string"
+ raise Error,"Too many decimal points in result string"
def str(val):
"""Convert float to integer, taking the locale into account."""