Mention %s change in abstract. Fix bug in code (found by Osvaldo Santana

Neto).
This commit is contained in:
Neil Schemenauer 2005-08-06 04:05:48 +00:00
parent ab9dab3ac4
commit c09c6c6a95
1 changed files with 7 additions and 4 deletions

View File

@ -15,9 +15,12 @@ Abstract
This PEP proposes the introduction of a new built-in function,
text(), that provides a way of generating a string representation
of an object. This function would make it easier to write library
code that processes string data without forcing the use of a
particular string type.
of an object without forcing the result to be a particular string
type. In addition, the behavior %s format specifier would be
changed to call text() on the argument. These two changes would
make it easier to write library code that can be used by
applications that use only the str type and by others that also use
the unicode type.
Rationale
@ -90,7 +93,7 @@ Specification
if isinstance(s, basestring):
return s
r = s.__str__()
if not isinstance(s, basestring):
if not isinstance(r, basestring):
raise TypeError('__str__ returned non-string')
return r