【发布时间】:2011-10-30 02:14:31
【问题描述】:
Python 中是否可以有重载函数?
在 C# 中我会做类似的事情
void myfunction (int first, string second)
{
# Some code
}
void myfunction (int first, string second, float third)
{
# Some different code
}
然后当我调用该函数时,它会根据参数的数量区分两者。是否可以在 Python 中做类似的事情?
【问题讨论】:
-
这似乎是一个重复的帖子。另外请不要标记为 C#,因为问题与 C# 无关。 function-overloading-in-python-missing
标签: python function arguments overloading