mirror of
https://github.com/python/cpython.git
synced 2025-08-01 07:33:08 +00:00
compare types with is not ==
This commit is contained in:
parent
a617e208fc
commit
28e369a8f8
1 changed files with 2 additions and 2 deletions
|
@ -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))
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue