python怎么实现函数多态性
python怎样实现函数多态性
在python实现函数的多态性,具体方法以下:
def remove_user(self,user_or_username):
try:
#If user_or_username is a User object
username = user_or_username.name
except AttributeError: #Oops -- didn't works. ask forgiveness ;-)
#If user_or_username is a string
username = user_or_username
remote.remove(username)
文章来源:丸子建站
文章标题:python怎么实现函数多态性
https://www.wanzijz.com/view/4342.html