title: How do I create an alternative constructor using a class method?
body: <p>The following code should generate an <code>Employee</code> instance from an employee string but doesn't seem to work. The instance is not created. How do I make it work?</p>
  <pre><code>class Employee:
      def __init__(self,first,last,pay):
          self.first=first
          self.last=last
          self.pay=pay
      def pay_increase(self):
          self.pay += (self.pay * 0.1)
      def emp_str(self,emp_str):
          first , last , pay = emp_str.split('-')
          
  emp1=Employee('reza','azaf',2000)
  emp1.pay_increase()
  
  emp2_str= 'rezd-454-454'
  emp2 = Employee.emp_str(emp2_str)
  print(emp2.first)
  </code></pre>