summaryrefslogtreecommitdiffstats
path: root/Lib/string.py
diff options
context:
space:
mode:
authorEric Smith <eric@trueblade.com>2007-08-27 11:28:18 (GMT)
committerEric Smith <eric@trueblade.com>2007-08-27 11:28:18 (GMT)
commite226b559637ca8a9972879b1ce33c9d99f449636 (patch)
tree31ee1c66165b8eee735d9ae39a9ed0f5378c25c8 /Lib/string.py
parent8cef8a89029651d1067510b9f776e1e450504b7b (diff)
downloadcpython-e226b559637ca8a9972879b1ce33c9d99f449636.zip
cpython-e226b559637ca8a9972879b1ce33c9d99f449636.tar.gz
cpython-e226b559637ca8a9972879b1ce33c9d99f449636.tar.bz2
PEP 3101: Removed _formatter_xxx routines from sysmodule, and made them unicode methods instead (per GvR suggestion).
Diffstat (limited to 'Lib/string.py')
-rw-r--r--Lib/string.py10
1 files changed, 4 insertions, 6 deletions
diff --git a/Lib/string.py b/Lib/string.py
index edf5ae2..0663f31 100644
--- a/Lib/string.py
+++ b/Lib/string.py
@@ -200,10 +200,8 @@ class Template(metaclass=_TemplateMetaclass):
# exposed here via the sys module. sys was chosen because it's always
# available and doesn't have to be dynamically loaded.
-# The overall parser is implemented in sys._formatter_parser.
-# The field name parser is implemented in sys._formatter_field_name_split
-
-from sys import _formatter_parser, _formatter_field_name_split
+# The overall parser is implemented in str._formatter_parser.
+# The field name parser is implemented in str._formatter_field_name_split
class Formatter:
def format(self, format_string, *args, **kwargs):
@@ -213,13 +211,13 @@ class Formatter:
used_args = set()
result = []
for (is_markup, literal, field_name, format_spec, conversion) in \
- _formatter_parser(format_string):
+ format_string._formatter_parser():
if is_markup:
# given the field_name, find the object it references
# split it into the first part, and and iterator that
# looks over the rest
- first, rest = _formatter_field_name_split(field_name)
+ first, rest = field_name._formatter_field_name_split()
used_args.add(first)
obj = self.get_value(first, args, kwargs)