Replies: 1 comment 1 reply
-
Ah, I've explained this a bit #1848, and it's indeed code, it doesn't do much, except the full rightmost expression is evaluated, and indeed assigned multiple times. If you want to open a PR to clean up that code that would be appreciated. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi @maartenbreddels
I am sorry, this is a pure python question.
I could find this line of code in
AggregatorDescriptorMean.add_tasks()
, line 355.expression = expression_sum = expression = df[str(self.expression)]
Googling chained assignments in Python, I could find this wikipedia ressource explaining:
The assignments are executed left-to-right so that
i = arr[i] = f()
evaluates the expressionf()
, then assigns the result to the leftmost targeti
, and then assigns the same result to the next targetarr[i]
, using the new value ofi
. This is essentially equivalent totmp = f(); i = tmp; arr[i] = tmp
Applied to this row in
add_task()
, it would translate if I am right into:I don't understand why assigning twice the same value to
expression
. Please, what am I missing?Thanks for your reply.
Have a good day,
Bests,
Beta Was this translation helpful? Give feedback.
All reactions