I\'m trying to create an employee
object via user input, but I\'m running into issues with my code. When I run this nothing happens and it\'s not throwing any e
The reason this isn't running is because you've defined a class, but then there is nothing that is instantiating that class, so nothing happens when you run it.
However, if you were to add that code to instantiate a class, say:
e = employee()
e.create_employee()
you would run into errors caused by the circular nature of the code, as mentioned by @jonrsharpe.
You could move create_employees
outside of the class and have it be a wrapper which takes in input (into regular variables, or a dict
, but not the class itself), and instantiates the object using that input. You could then call that function from the main part of the script.
I would recommend reading through the Python doc on classes so you can become more familiar with the OO paradigm:
https://docs.python.org/2/tutorial/classes.html