Skip to content
This repository was archived by the owner on May 8, 2024. It is now read-only.
This repository was archived by the owner on May 8, 2024. It is now read-only.

Increase the usage of augmented assignment statements #91

@elfring

Description

@elfring

👀 Some source code analysis tools can help to find opportunities for improving software components.
💭 I propose to increase the usage of augmented assignment statements accordingly.

diff --git a/dpark/utils/tdigest.py b/dpark/utils/tdigest.py
index a0b4b7e..2369c10 100644
--- a/dpark/utils/tdigest.py
+++ b/dpark/utils/tdigest.py
@@ -97,8 +97,8 @@ class TDigest(object):
         def _argsort(seq):
             return sorted(range(len(seq)), key=seq.__getitem__)
 
-        incoming_weight = incoming_weight + self._weight
-        incoming_mean = incoming_mean + self._mean
+        incoming_weight += self._weight
+        incoming_mean += self._mean
 
         assert incoming_weight
 
@@ -121,7 +121,7 @@ class TDigest(object):
             q2 = (w_so_far + proposed_weight) / self._total_weight
             if z * z <= q0 * (1 - q0) and z * z <= q2 * (1 - q2):
                 weight[-1] += incoming_weight[ix]
-                mean[-1] = mean[-1] + (incoming_mean[ix] - mean[-1]) * incoming_weight[ix] / weight[-1]
+                mean[-1] += (incoming_mean[ix] - mean[-1]) * incoming_weight[ix] / weight[-1]
 
             else:
                 w_so_far += weight[-1]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions