0
我要疊加+ - 運營商一個Django場:覆蓋+運營商的Django場
x+y --> x | y (bitwise or)
x-y --> x & (~y) (almost the inverse of above)
如果把覆蓋定義是什麼?下面是錯誤的:
class BitCounter(models.BigIntegerField):
description = "A counter used for statistical calculations"
__metaclass__ = models.SubfieldBase
def __radd__(self, other):
return self | other
def __sub__(self, other):
return self & (^other)
謝謝,工作完美! – MrJ 2013-02-23 00:56:52