Skip to content

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

Merged
JelleZijlstra merged 3 commits intopsf:mainfrom
bbugyi200:2294-fix-plus-equal-assignment-string-splitting
Jun 7, 2021
Merged

Account for += assignment when deciding whether to split string#2312
JelleZijlstra merged 3 commits intopsf:mainfrom
bbugyi200:2294-fix-plus-equal-assignment-string-splitting

Conversation

@bbugyi200
Copy link
Copy Markdown
Contributor

Fixes #2294

Copy link
Copy Markdown
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
Copy Markdown
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