11__author__ = "Jerry"
2- __version__ = "1.2.0 "
2+ __version__ = "1.2.1 "
33
44class NotComposedOfNumbersError (Exception ):
55 "不是由数字组成的字符串使用String对象的toInt()函数或toInteger()函数时抛出"
@@ -23,16 +23,16 @@ def __repr__(self) -> str:
2323 def __add__ (self , other ):
2424 "当与一个字符串或另一个String对象进行加操作时调用"
2525 if type (other ) is String :
26- return self .__str + other .__str
26+ return String ( self .__str + other .__str )
2727 else :
28- return self .__str + other
28+ return String ( self .__str + other )
2929
3030 def __sub__ (self , other ):
3131 "当与一个字符串或另一个String对象进行减操作时调用"
3232 if type (other ) is String :
33- return self .__str - other .__str
33+ return String ( self .__str - other .__str )
3434 else :
35- return self .__str - other
35+ return String ( self .__str - other )
3636
3737 def isNumber (self ):
3838 "判断字符串是否由数字组成,返回布尔值"
@@ -78,16 +78,16 @@ def __repr__(self) -> str:
7878 def __add__ (self , other ):
7979 "当与一个整数或另一个Integer对象进行加操作时调用"
8080 if type (other ) is Integer :
81- return self .__int + other .__int
81+ return Integer ( self .__int + other .__int )
8282 else :
83- return self .__int + other
83+ return Integer ( self .__int + other )
8484
8585 def __sub__ (self , other ):
8686 "当与一个整数或另一个Integer对象进行减操作时调用"
8787 if type (other ) is Integer :
88- return self .__int - other .__int
88+ return Integer ( self .__int - other .__int )
8989 else :
90- return self .__int - other
90+ return Integer ( self .__int - other )
9191
9292 def toStr (self ):
9393 "将整数转成字符串"
0 commit comments