Mention %s change in abstract. Fix bug in code (found by Osvaldo Santana
Neto).
This commit is contained in:
parent
ab9dab3ac4
commit
c09c6c6a95
11
pep-0349.txt
11
pep-0349.txt
|
@ -15,9 +15,12 @@ Abstract
|
||||||
|
|
||||||
This PEP proposes the introduction of a new built-in function,
|
This PEP proposes the introduction of a new built-in function,
|
||||||
text(), that provides a way of generating a string representation
|
text(), that provides a way of generating a string representation
|
||||||
of an object. This function would make it easier to write library
|
of an object without forcing the result to be a particular string
|
||||||
code that processes string data without forcing the use of a
|
type. In addition, the behavior %s format specifier would be
|
||||||
particular string type.
|
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
|
Rationale
|
||||||
|
@ -90,7 +93,7 @@ Specification
|
||||||
if isinstance(s, basestring):
|
if isinstance(s, basestring):
|
||||||
return s
|
return s
|
||||||
r = s.__str__()
|
r = s.__str__()
|
||||||
if not isinstance(s, basestring):
|
if not isinstance(r, basestring):
|
||||||
raise TypeError('__str__ returned non-string')
|
raise TypeError('__str__ returned non-string')
|
||||||
return r
|
return r
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue