热线电话:13121318867

登录
2019-02-20 阅读量: 742
Python中的多态性是什么

什么是多态性:多态性这个词意味着有很多形式。在编程中,多态性意味着相同的函数名称(但不同的签名)用于不同的类型。

内置多态函数的示例:

# Python program to demonstrate in-built poly-

# morphic functions

# len() being used for a string

print(len("geeks"))

# len() being used for a list

print(len([10, 20, 30]))

Output:

5
3
64.3413
0
关注作者
收藏
评论(0)

发表评论

暂无数据
推荐帖子