Skip to content
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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

'Solution' #1206

wants to merge 1 commit into from

Conversation

spa7id
Copy link

@spa7id spa7id commented Oct 4, 2024

No description provided.

Copy link

@skyfoxwork skyfoxwork left a 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:
Copy link

@skyfoxwork skyfoxwork Oct 5, 2024

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__ ()

Copy link
Contributor

@Arsen-hrynevych Arsen-hrynevych left a 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)
Copy link
Contributor

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.

Copy link

@skyfoxwork skyfoxwork Oct 5, 2024

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.

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.

3 participants