Skip to content

2to3: Apply repr fixer. #3208

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 8, 2013
Merged

Conversation

Image for: Conversation
Copy link
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.

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 numpy#3083.
Copy link
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 added a commit that referenced this pull request Apr 8, 2013
njsmith merged commit f85bdf4 into numpy:master Apr 8, 2013
Copy link
Member Author

charris commented Apr 8, 2013

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

charris deleted the 2to3-apply-repr-fixer branch April 8, 2013 19:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants