t-rexdex / py_bootcamp

Python Bootcamp
0 stars 0 forks source link

Very bad practice when assigning instance variable without declaring it in its class #1

Open huytran187 opened 1 year ago

huytran187 commented 1 year ago

https://github.com/t-rexdex/py-bootcamp/blob/5a37a11695980110cee8490e21dd5ab189cb9138/nile-project/test.py#L54

huytran187 commented 1 year ago

Think if this is actually neccessary in Trip: you basically don't ever use driver.cost in a trip instance. You also have not declared it at Driver class, which is a very bad practice. More importantly, a cost is not specific to a driver. it is more or less specific to a trip.