Skip to content

olya_task5_improving_car_class - #43

Open
olyapetryshyn wants to merge 3 commits into
masterfrom
olya_improving_car_class
Open

olya_task5_improving_car_class#43
olyapetryshyn wants to merge 3 commits into
masterfrom
olya_improving_car_class

Conversation

@olyapetryshyn

Copy link
Copy Markdown
Collaborator

No description provided.

Comment thread olya_petryshyn/improve_car_class.py Outdated
self.car_type = new_car_type

def set_car_type(self, some_car_type):
for child_class in Car.__subclasses__():

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please don't use megic methods directly.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed.

Comment thread olya_petryshyn/improve_car_class.py Outdated
for child_class in Car.__subclasses__():
temp_object = child_class(self.model, self.year, self.max_speed)
if some_car_type.title() == temp_object.car_type:
self = temp_object

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a bad idea to override self.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done.

self.car_type = new_car_type

def set_car_type(self, some_car_type):
subclasses = Car.__subclasses__()

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please. don't use magic methods directly! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants