xxxxxxxxxx
# Alternative constructor with class method
class Employee:
def __init__(self, first, last):
self.first = first
self.last = last
@classmethod
def from_string(cls, emp_str):
first, last = emp_str.split(' ')
return cls(first, last) # cls() is the same as Employee()
emp_1 = Employee('John', 'Smith')
emp_2 = Employee.from_string('Jane Doe')