[Python-ideas] Deprecating repr() and the like

Serhiy Storchaka storchaka at gmail.com
Fri Aug 9 21:48:42 CEST 2013


repr(), ascii() and one-argument str() can be deprecated and removed in 
Python 5.0 because they are redundant and can be expressed as a simple 
formatting:

repr(x) == '%r'%(x,) == '{!r}'.format(x)
ascii(x) == '%a'%(x,) == '{!a}'.format(x)
str(x) == '%s'%(x,) == '{}'.format(x)

We also can deprecate string concatenation for the same reason:

s1 + s2 == '%s%s'%(s1,s1) == '{}{}'.format(s1,s2) == ''.join([s1,s2])



More information about the Python-ideas mailing list