diff options
author | Raymond Hettinger <python@rcn.com> | 2009-01-26 02:09:03 (GMT) |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2009-01-26 02:09:03 (GMT) |
commit | 89e12963ad7f0551b325b282267ad21011aa5fd7 (patch) | |
tree | c9cd271493eea6347e0d171a6fff80db75c4accb /Lib/locale.py | |
parent | d0005ff41fdb3e8806aaaf812a71ba507a83b14c (diff) | |
download | cpython-89e12963ad7f0551b325b282267ad21011aa5fd7.zip cpython-89e12963ad7f0551b325b282267ad21011aa5fd7.tar.gz cpython-89e12963ad7f0551b325b282267ad21011aa5fd7.tar.bz2 |
As discussed on python-dev, remove several operator functions
isSequenceType(), isMappingType(), and isNumberType() in favor
of using abstract base classes. Also, remove repeat() and irepeat()
in favor of mul() and imul().
After the buildbots have had a go at this. Will backport to Py3.0.1.
For Py2.7, will just mark as deprecated.
Diffstat (limited to 'Lib/locale.py')
-rw-r--r-- | Lib/locale.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Lib/locale.py b/Lib/locale.py index 0bed19e..4116ef1 100644 --- a/Lib/locale.py +++ b/Lib/locale.py @@ -187,7 +187,7 @@ def format(percent, value, grouping=False, monetary=False, *additional): formatted = _group(formatted, monetary=monetary)[0] return formatted -import re, operator +import re, collections _percent_re = re.compile(r'%(?:\((?P<key>.*?)\))?' r'(?P<modifiers>[-#0-9 +*.hlL]*?)[eEfFgGdiouxXcrs%]') @@ -207,7 +207,7 @@ def format_string(f, val, grouping=False): del new_val[i+1:i+1+starcount] i += (1 + starcount) val = tuple(new_val) - elif operator.isMappingType(val): + elif isinstance(val, collections.Mapping): for perc in percents: key = perc.group("key") val[key] = format(perc.group(), val[key], grouping) |