1
1
__author__ = "Jerry"
2
- __version__ = "1.2.0 "
2
+ __version__ = "1.2.1 "
3
3
4
4
class NotComposedOfNumbersError (Exception ):
5
5
"不是由数字组成的字符串使用String对象的toInt()函数或toInteger()函数时抛出"
@@ -23,16 +23,16 @@ def __repr__(self) -> str:
23
23
def __add__ (self , other ):
24
24
"当与一个字符串或另一个String对象进行加操作时调用"
25
25
if type (other ) is String :
26
- return self .__str + other .__str
26
+ return String ( self .__str + other .__str )
27
27
else :
28
- return self .__str + other
28
+ return String ( self .__str + other )
29
29
30
30
def __sub__ (self , other ):
31
31
"当与一个字符串或另一个String对象进行减操作时调用"
32
32
if type (other ) is String :
33
- return self .__str - other .__str
33
+ return String ( self .__str - other .__str )
34
34
else :
35
- return self .__str - other
35
+ return String ( self .__str - other )
36
36
37
37
def isNumber (self ):
38
38
"判断字符串是否由数字组成,返回布尔值"
@@ -78,16 +78,16 @@ def __repr__(self) -> str:
78
78
def __add__ (self , other ):
79
79
"当与一个整数或另一个Integer对象进行加操作时调用"
80
80
if type (other ) is Integer :
81
- return self .__int + other .__int
81
+ return Integer ( self .__int + other .__int )
82
82
else :
83
- return self .__int + other
83
+ return Integer ( self .__int + other )
84
84
85
85
def __sub__ (self , other ):
86
86
"当与一个整数或另一个Integer对象进行减操作时调用"
87
87
if type (other ) is Integer :
88
- return self .__int - other .__int
88
+ return Integer ( self .__int - other .__int )
89
89
else :
90
- return self .__int - other
90
+ return Integer ( self .__int - other )
91
91
92
92
def toStr (self ):
93
93
"将整数转成字符串"
0 commit comments