有没有办法为不同版本的python定义不同的函数(具有相同的主体)?
具体来说,对于 python 2.7 定义:
def __unicode__(self):
对于 python 3 定义:
def __str__(self):
但两者都有相同的代码/主体。两者都必须是班级成员。
python multiple-versions
multiple-versions ×1
python ×1