HOME/Articles/

2017-9-14 通过__slots__节省内存

Article Outline

<!--more-->

见原文

class Measurement:
    __slots__ = ['x', 'y', 'val']

    def __init__(self, x, y, value):
        self.x = x
        self.y = y
        self.val = value

merge dict

merged_dict

dict_merged = {**a, **b, **c}