Skip to content
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

Account for += assignment when deciding whether to split string #2312

Conversation

bbugyi200
Copy link
Contributor

Fixes #2294

Copy link
Collaborator

@JelleZijlstra JelleZijlstra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this also cover other augmented assignment operators? I don't think any appear with strings in practice much though, maybe %=.

Thanks for the PR!

@JelleZijlstra JelleZijlstra merged commit 6380b9f into psf:main Jun 7, 2021
@Jackenmen
Copy link
Contributor

I'm not sure how often pathlib.Path is used with the augmented assignment operator rather than the regular one (/) nor do I know how often the string would be long enough that it would need to be split but all that aside, /= can definitely appear with strings on the right-hand of the assignment operator too:

from pathlib import Path
x = Path.cwd()
x /= "directory/subdirectory/file.txt"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

String processing produces code exceeding length limit
3 participants