if I create a class called Car
class Car():
'''car information summary'''
def __init__(self, make, model, year):
self.make = make
self.model = model
self.year = year
self.odometer = 0
I learned that self.odometer=0 allowed me creating a new instance without putting a value for odometer. Every new instance will start with an odometer reading at 0.
But what if I want to create an new instance with a specified odometer reading?
car_1 = Car('Audi', 'S4', '2017', 5000)
It won't allow me to do so. What I am trying to do is to use it like a default value for a function: You don't have to give a value because there is a default, but when you do, you can overwrite the default.
And I do understand that I can revise the attribute afterwards, or write a method to change the attribute. But that's not my concern for now.
Is this a wrong idea to have for OOP?