2019-06-25
阅读量:
381
如何理解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]))
输出:
5
3






评论(0)


暂无数据
推荐帖子
0条评论
0条评论
0条评论