All Questions
Tagged with inheritancepython
52 questions
9votes
3answers
573views
Parsing SFV files to extract and store the hashes
Similar to the class for the RAR file, now a class to extract and store the hashes from SFV files. Though this was considerably easier, there has been some code reorganisation: there is now an ...
32votes
5answers
5kviews
Chess game for my students
I teach programming, and I currently teach my class about inheritance, abstract classes, and mixins. I wrote this code as an example, and I want to be sure it is as good as possible before I release ...
1vote
1answer
219views
Python3 currency abstract class (without the permission to be instantiated directly)
I'm a newbie python developer who accidentally studied the concept of Abstract classes and I found it pretty much helpful to implement due to the SOLID principles. At the very moment of testing and ...
1vote
1answer
72views
Python 3.10+: an exploration of meta classes and subclasses through the lens of metric (SI) prefixes with subclass-able units and changeable bases
Problem Statement From the National Institute of Standards and Technology's Office of Weights and Measures, one can find a handy list of all the metric prefixes: e.g. Purpose Name Symbol Factor Name ...
2votes
0answers
124views
A Python base class for a family of Postgres server manager classes
I'm working on a repo the purpose of which is to create and manage a local PostGIS server. (PostGIS is a bit niche, but it boils down to a few extra spatial data types and built-in SQL function. With ...
1vote
2answers
3kviews
Ensuring that attributes referenced by a mixin are present in the children class
I have implemented the below _get_schema method to ensure that schema attribute is always present on the ...
3votes
2answers
460views
Alarm clock subclass of a clock
I have these two classes and they should remain separate classes, but I have a feeling that this could be implemented more efficiently and with less duplicate code. After googling around I still didn'...
3votes
0answers
114views
Build the Mountain Car Environment using coupled inheritance and type annotations
This code builds the environment for the standard Mountain Car Problem of reinforcement learning. I'm using Python 3.9 with PyCharm and I'm wishing to use type annotations throughout. I'm trying to ...
1vote
0answers
61views
How was this python code analyze these classes with class diagram
Anyone please review my code and give some improvement suggestions. I wrote code but not to the best standards. I think this site give some valuable suggestions this code is for extracting xlsx or csv ...
19votes
2answers
10kviews
A Python wrap-around list
I want to gain experience creating data structures that look and feel like Python builtin types. As a first exercise, I've written a WraparoundList class meant to ...
14votes
3answers
6kviews
Create dictionary with default immutable keys
I've created a dictionary subclass with a set of default immutable keys. ...
4votes
2answers
9kviews
Structure of inheritance between Animal classes and methods
I'm trying to do some basic inheritance between the 3 classes and use some simple methods, and I'm looking to learn what should be the correct structure between them and what can be improved. ...
1vote
1answer
4kviews
Write a class for Team which should have function to prints players details
I have written it using aggregation but i feel its not the best way we can do this. Please suggest is there any other way to do this. I think we can also built this without using player class, just ...
1vote
1answer
167views
OOP paradigm in python - Extend class functionalities
I am a novice of Python and I am trying to understand how to use OOP paradigm to improve my scripts. My scripts usually read some data from a formatted csv file and perform some numerical analysis. ...
2votes
1answer
167views
Read data from file: better approach using OOP
Suggestions to better understand when and how is convenient to use OPP. This question is a follow-up question on this post. I have a script that reads an input file. In time, the script may be ...