Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork187
refactoring code with Assign Multiple Targets#128
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:main
Are you sure you want to change the base?
Uh oh!
There was an error while loading.Please reload this page.
Conversation
refactoring code with Assign Multiple Targets which is more pythonic, concise, readable and efficient; how do think this change which has practical value?
data[ii + 1] = data[jj + 1] | ||
data[jj] = tmp_real | ||
data[jj + 1] = tmp_imag | ||
data[ii] , data[ii + 1] , data[jj] , data[jj + 1] = data[jj], data[jj + 1], data[ii], data[ii + 1] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Personally, I find that harder to read.
idiomaticrefactoringFeb 8, 2022 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
How about adding a comment? it maybe more readable.#swap two imaginary numbers with real part and imaginary part (data[ii],data[ii+1]) <->(data[jj],data[jj+1]) .
Yes, it maybe more longer making it seems harder read. How about if we first look atdata[ii]
to the left of “=”, then look atdata[jj]
to the right of “=”, then loop the operation? Sometimes, I find the original code have more statements making me a little scared and confused to read the code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
It is indeed harder to read and we should avoid changing benchmarks unless necessary, BTW the bytecode will now use unpack sequence rather than store name so will have an effect on its specialization.
refactoring code with Assign Multiple Targets which is more pythonic, concise, readable and efficient; how do think this change which has practical value?