为什么在Python类中有时使用cls而不是self作为参数?
例如:
class Person:
def __init__(self, firstname, lastname):
self.firstname = firstname
self.lastname = lastname
@classmethod
def from_fullname(cls, fullname):
cls.firstname, cls.lastname = fullname.split(' ', 1)