-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
'Solution' #1206
base: master
Are you sure you want to change the base?
'Solution' #1206
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think good job!
But if you will use:
self.skills.extend([skill])
instead of:
self.skills.append(skill)
and
self.skills.extend(["JavaScript", "HTML", "CSS"])
insted of:
self.skills = ["JavaScript", "HTML", "CSS"]
and so on it other clesses.
I think it will better!
And then you don't need init() method in FullStackDeveloper class.
|
||
|
||
class FullStackDeveloper(BackendDeveloper, FrontendDeveloper): | ||
def __init__(self, name: str) -> None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if you will use
self.skills.extend(["skill_one", "skill_two", "skill_three"])
in classes above
you don't need
__init__ ()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mostly correct
|
||
class FullStackDeveloper(BackendDeveloper, FrontendDeveloper): | ||
def __init__(self, name: str) -> None: | ||
super().__init__(name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are inheriting from both BackendDeveloper and FrontendDeveloper. Since both classes are children of SoftwareEngineer, Python's method resolution order (MRO) will only call the init method from the first parent class (BackendDeveloper).
This means the FrontendDeveloper's skills won't be initialized unless you call the init of both parents explicitly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with you!
But it work without init() method
I think it is because when we use method self.create_awesome_web_page() that inherited from Frontend Developer it will run init() method from FrontendDeveloper.
I mean that if we don't use init method for FullStackDeveloper,
self.create_powerful_api() will use BackendDeveloper init method,
self.create_awesome_web_page() will use FrontendDeveloper init method.
No description provided.