forked from shnela/python_course
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
51 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import os | ||
|
||
fileToDump = 'duped_class.json' | ||
|
||
from random import randint | ||
|
||
class SomeClass: | ||
def __init__(self, ATTR1, attr2): | ||
self.ATTR1 = ATTR1 | ||
self.attr2 = attr2 | ||
|
||
def printAttributes(self): | ||
print(f'attrs: {self.ATTR1}, {self.attr2}') | ||
|
||
class inheritedClass(SomeClass): | ||
def printAttributes(self): | ||
print(f"attrs: {self.attr2}, {self.ATTR1}") | ||
|
||
def generate_int() -> str: | ||
return randint(0, 10) | ||
|
||
if __name__ == '__main__': | ||
Number = generate_int() | ||
classInstance = SomeClass(Number, 'other attribute') | ||
classInstance.printAttributes() | ||
|
||
subclassInstance = inheritedClass(Number, "other attribute") | ||
subclassInstance.printAttributes() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters