相关疑难解决方法(0)

python中重载的函数?

是否有可能在Python中重载函数?在C#中,我会做类似的事情

void myfunction (int first, string second)
{
//some code
}
void myfunction (int first, string second , float third)
{
//some different code
}
Run Code Online (Sandbox Code Playgroud)

然后当我调用函数时,它会根据参数的数量区分两者.是否有可能在Python中做类似的事情?

python arguments overloading function

83
推荐指数
3
解决办法
9万
查看次数

标签 统计

arguments ×1

function ×1

overloading ×1

python ×1