Kaydet (Commit) 28e369a8 authored tarafından Benjamin Peterson's avatar Benjamin Peterson

compare types with is not ==

üst a617e208
...@@ -3517,12 +3517,12 @@ class Decimal(object): ...@@ -3517,12 +3517,12 @@ class Decimal(object):
return (self.__class__, (str(self),)) return (self.__class__, (str(self),))
def __copy__(self): def __copy__(self):
if type(self) == Decimal: if type(self) is Decimal:
return self # I'm immutable; therefore I am my own clone return self # I'm immutable; therefore I am my own clone
return self.__class__(str(self)) return self.__class__(str(self))
def __deepcopy__(self, memo): def __deepcopy__(self, memo):
if type(self) == Decimal: if type(self) is Decimal:
return self # My components are also immutable return self # My components are also immutable
return self.__class__(str(self)) return self.__class__(str(self))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment