2to3: Apply `repr` fixer. #3208

Merged
merged 1 commit into from Apr 8, 2013

Projects

None yet

2 participants

@charris
Member
charris commented Apr 8, 2013

This replaces python backtics with repr(...). The backtics were mostly
used to generate strings for printing with a string format and it is
tempting to replace '%s' % repr(x) with '%r' % x. That would work
except where x happened to be a tuple or a dictionary but, because it
would be significant work to guarantee that and because there are not
many places where backtics are used, the safe path is to let the repr
replacements stand.

Closes #3083.

@charris charris 2to3: Apply `repr` fixer.
This replaces python backtics with repr(...). The backtics were mostly
used to generate strings for printing with a string format and it is
tempting to replace `'%s' % repr(x)` with `'%r' % x`. That would work
except where `x` happened to be a tuple or a dictionary but, because it
would be significant work to guarantee that and because there are not
many places where backtics are used, the safe path is to let the repr
replacements stand.

Closes #3083.
011f8a2
@njsmith
Member
njsmith commented Apr 8, 2013

That's why even when substituting just a single item it's better to always write '...' % (x,)... but going through to apply this transformation to the existing code is a waste of time :-)

@njsmith njsmith merged commit f85bdf4 into numpy:master Apr 8, 2013

1 check passed

default The Travis build passed
Details
@charris
Member
charris commented Apr 8, 2013

I briefly, like for ten seconds, considered that, but came to the same conclusion that you did ;)

@charris charris deleted the charris:2to3-apply-repr-fixer branch Apr 8, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment