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 #1187

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open

Solution #1187

wants to merge 6 commits into from

Conversation

vkalinina
Copy link

No description provided.

app/main.py Outdated
@@ -1 +1,58 @@
# write your code here
class SoftwareEngineer:
skills = []

Choose a reason for hiding this comment

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

skills is mutable object (a list), is shared among all instances and subclasses, leading to unpredictable behavior when its contents are modified. This means that adding skills in one instance can affect all others that inherit from this class. You should move skills to an instance-level variable within the constructor, ensuring each instance has its own separate list of skills.

app/main.py Outdated
Comment on lines 46 to 51
def __init__(self, name: str) -> None:
super().__init__(name)
self.skills = (
BackendDeveloper(self.name).skills
+ FrontendDeveloper(self.name).skills
)
Copy link

Choose a reason for hiding this comment

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

__init__ method redundant here

app/main.py Outdated
class FrontendDeveloper(SoftwareEngineer):
def __init__(self, name: str) -> None:
super().__init__(name)
self.skills = ["JavaScript", "HTML", "CSS"]
Copy link

Choose a reason for hiding this comment

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

Suggested change
self.skills = ["JavaScript", "HTML", "CSS"]
self.skills += ["JavaScript", "HTML", "CSS"]

Don't override skills, but updated them.

Choose a reason for hiding this comment

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

Still not fixed

app/main.py Outdated
class FrontendDeveloper(SoftwareEngineer):
def __init__(self, name: str) -> None:
super().__init__(name)
self.skills = ["JavaScript", "HTML", "CSS"]

Choose a reason for hiding this comment

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

Still not fixed

app/main.py Outdated
Comment on lines 46 to 48
def __init__(self, name: str) -> None:
super().__init__(name)
self.skills += ["JavaScript", "HTML", "CSS"]

Choose a reason for hiding this comment

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

init method redundant here

app/main.py Outdated
Comment on lines 46 to 47
def __init__(self, name: str) -> None:
super().__init__(name)
Copy link

Choose a reason for hiding this comment

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

__init__ method redundant here

app/main.py Outdated
Comment on lines 54 to 56

ben = FullStackDeveloper("Ben")
print(ben.skills)
Copy link

Choose a reason for hiding this comment

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

remove this two line

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.

4 participants