class Employee:
def __init__(self, lastname, firstname = None):
self.lastname = lastname
self.firstname = firstname
What does firstname = None in the second row mean?
This allows you to call this function and omit that particular parameter. If you do omit it, it will default to the listed value of None. If you do pass a value, it will be used.
>>> def f(arg='a'):
... print(arg)
...
>>> f()
a
>>> f('b')
b
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With