Skip to main content

All Questions

Filter by
Sorted by
Tagged with
1 vote
1 answer
83 views

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 ...
SumNeuron's user avatar
  • 281
2 votes
1 answer
82 views

Extract Excel or CSV and convert to JSON: analyze these classes with class diagram

Please review my code and give some improvement suggestions. I wrote code but not to the best standards. I think this site gives some valuable suggestions. This code is for extracting ...
Mohanraj M's user avatar
3 votes
2 answers
460 views

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'...
LostHat's user avatar
  • 33
-2 votes
2 answers
96 views

Multiple inheritance of class broken up into modules [closed]

I have a class Main that uses fn(cls, ...) methods from several modules; they're used exclusively by ...
OverLordGoldDragon's user avatar
2 votes
1 answer
170 views

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 ...
Stefano's user avatar
  • 55
1 vote
1 answer
167 views

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. ...
Stefano's user avatar
  • 55
5 votes
1 answer
344 views

List subclasses of a class

Description Given a class, return all its subclasses (recursively). As you can see I've eliminated recursion using a stack. What I want reviewed Is there a better way to do this? How can I make this ...
JaDogg's user avatar
  • 4,541
2 votes
0 answers
285 views

Python logging setup for a package

I'm running a package that downloads data from the internet. This package makes logging calls from different modules. Suppose I have a package 'demopackage'. Here is how my logging is currently set ...
ubro's user avatar
  • 21
1 vote
1 answer
4k views

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 ...
Mrityunjay's user avatar
5 votes
0 answers
896 views

Writing a metaclass to ensure a class is thread-safe

Python allows the creation of classes to be modified via metaclasses. They can perform all sorts of operations that might appear to be magical to languages that do not have the capability. The goal of ...
Noctis Skytower's user avatar
1 vote
0 answers
1k views

Marking a class as final or sealing a class

Which of these metaclasses should be preferred, and is there room for improvement? Some people are not familiar with the philosophies that come with working in Python and have a desire embedded in ...
Noctis Skytower's user avatar
1 vote
1 answer
264 views

Implementing Abstract class

I used Pythons source code/documentation/textbook to come up with an abstract class and following subclasses. My requirements are: Domestic students don't require documentation International student ...
user avatar
3 votes
0 answers
44 views

Create, aggregate and plot signals using various methods for a given symbol using its historical data

I am hoping to get some help regarding code arrangement/organization using OOP concepts. My question is whether my usage of class/object selection/declaration and instantiation are sensible and what ...
dayum's user avatar
  • 131
10 votes
1 answer
264 views

Implementing a Maybe for multidimensional data

The scenario is we're working with a REST endpoint that gives us nice JSON objects. We're using requests, and everything works wonderfully. But one day you notice that data you though was always being ...
Peilonrayz's user avatar
  • 44.2k
19 votes
2 answers
10k views

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 ...
Endulum's user avatar
  • 383

15 30 50 per page