Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.

Questions tagged [python]

Python is a dynamically typed, high-level interpreted programming language. Its design focuses on clear syntax, an intuitive approach to object-oriented programming, and making the right way to do things obvious. Python supports modules and exceptions, and has an extensive standard module library. Python is general-purpose and thus used widely, from the web to embedded systems.

Filter by
Sorted by
Tagged with
0 votes
2 answers
185 views

I have a Python class called FunctionsManager; its __init__() method is the following: class FunctionsManager: def __init__(self, instance_class1, instance_class2, ..., instance_classN): ...
User051209's user avatar
2 votes
1 answer
167 views

I'm working on a web-based app that uses Django and Angular. This app uses several external APIs to fetch environmental data from different monitoring networks. We then use these data to perform ...
stray_dog's user avatar
2 votes
2 answers
255 views

I am a beginner programmer with little experience in building complex applications. Currently I'm making a messenger using Python's FastAPI for the back-end. The main thing that I am trying to achieve ...
i walk away's user avatar
3 votes
6 answers
602 views

I'm currently drafting a Python coding standard for internal enterprise use, primarily targeting business applications that involve heavy data access, reporting, and transactional logic. In this ...
agolta's user avatar
  • 77
0 votes
2 answers
376 views

im kind of a newbie so take me easy i face a problem every time i make a project specially Client projects, which is Global State i always struggle to do it for example, here is the structure of one ...
PythoonNoob9000's user avatar
3 votes
2 answers
264 views

I am developing a python package that needs to be able to read/write from/to multiple formats. E.g. foo format and bar format. I am trying to contain the functions relating to each format in a single ...
Luce's user avatar
  • 139
1 vote
1 answer
114 views

I'm looking for a method to map the content of a structured text file to a nested dictionary (dictionary tree). The text file consists of (nested) sections with each section starting with the pattern ...
user71769's user avatar
  • 121
4 votes
2 answers
502 views

I am trying to write a backend for use with a completely text based UI for one shot operations (eg. python scriptname arg, executes that argument and exits) and a GUI using the curses library for some ...
Hugo Schongin's user avatar
3 votes
1 answer
252 views

I'm having trouble with managing the working directory in Jupyter Notebook. For example, I have a .py script that requires me to change the working directory to its directory to run it properly. I've ...
newbie's user avatar
  • 47
0 votes
2 answers
429 views

I have a game server implemented in Python to which clients can connect and play against each other. I'd like to be able to reload configuration from a config file without restarting the server (as ...
luator's user avatar
  • 111
5 votes
2 answers
820 views

Say I am making a pdf editor app with the following structure: ├── main.py ├── 📂 drawing_functions/ ├── 📂 util/ ├── 📂 GUI/ └── 📂 document_handling/ Each of these folders have a collection of ...
Leftover Salad's user avatar
5 votes
5 answers
713 views

I am working on a refactor on a certain package (I can give details if asked). The package involves a clever lazy evaluation of a sort of nested sequence of arithmetic operations. If the numerical ...
Jagerber48's user avatar
0 votes
1 answer
232 views

Say I have a Python project that looks like this: project/ ├── package/ │ ├── __init__.py │ ├── module1.py └── main.py I would like package/ to be self-contained, though it is called from main.py....
Leftover Salad's user avatar
5 votes
2 answers
734 views

In Python when you want a local variable, you just assign to it x = 10. In most modern languages you declare local vars (regardless of type): JavaScript: let/const/var Swift: let/var Kotlin: val/var ...
noamtm's user avatar
  • 235
1 vote
2 answers
548 views

For an API client I am working on, I was wondering, whether the main class should be reusable. This question basically boils down to: should the HTTP client be instantiated in __init__ or __enter__/...
Jan's user avatar
  • 251
0 votes
0 answers
71 views

I'm working on a Python codebase which we are trying to improve the modularity of. Both the top level scripts and the modules that they depend on are all in one main repo. We have another repo which ...
Component 10's user avatar
-3 votes
2 answers
5k views

I mention python's argparse as an example but this would apply to any CLI argument parser library for any language. Just generally speaking, at a high level, if there are a lot of optional arguments ...
notacorn's user avatar
  • 109
1 vote
1 answer
359 views

I'm developing an api in Fast API using sqlalchemy to manage my ORM classes and operations with the database. I'm dealing with some design decisions to have my classes as little coupled as possible ...
Alejo Villores's user avatar
0 votes
2 answers
729 views

We manage a backend application behind a FastAPI REST controller with multiple endpoints. A member of our team decided to use a middleware on the application which parses the body of the response for ...
Blue_Elephant's user avatar
2 votes
1 answer
147 views

I am searching for a good design for a set of components I am writing for a system. I believe it is very likely there is a Design Pattern, or set of Design Patterns, which could be combined to solve ...
user3728501's user avatar
15 votes
4 answers
5k views

Generally, modules should not have side effects. However, in a lot of cases, the side-effects are hard to avoid or may be desirable. There are also popular packages with on-import side-effects. Which ...
Kaia's user avatar
  • 422
7 votes
2 answers
726 views

I've been experimenting with different data structures and algorithms in Python, Java and C to see in what circumstances function/method inlining could bring meaningful gains in terms of the execution ...
user avatar
0 votes
1 answer
262 views

note: here library means a package that is installed from some wheel/egg/tar file. as opposed to a regular package which is just a container of modules basically. package usually is used for both as ...
gnarlyninja's user avatar
0 votes
1 answer
210 views

Background To preface, I am building a database for the construction of a timing detector. However, I am very new to software engineering and database development. I have been building a website using ...
jfwinston32's user avatar
1 vote
1 answer
979 views

Before I begin, I want to say I am very new to this and I am a junior but also solo developer with no seniors to ask for guidance. Please feel free to explain to me that I am not approaching it ...
Zayd_MP's user avatar
  • 13
3 votes
1 answer
609 views

I want to understand what is considered best-practice to better align with OOP when handling relational databases. I cannot find any online examples where classes and a more maintainable/re-usable ...
Yannis's user avatar
  • 147
-2 votes
1 answer
521 views

Say I have a class with a function do_thing that is comprised of multiple steps, which themselves segregate into functions (first_process and second_process). At what point would this be considered ...
Tim Kirkwood's user avatar
1 vote
3 answers
865 views

I have a flask server which uses a controller-service-resource model. For simplification it is like this: Controller(parses requests, dispatches to A or B): ServiceA ServiceB However there are ...
VectorVictor's user avatar
2 votes
1 answer
158 views

I am writing some python 3 bioinformatics software and was wondering about the best way to write it in an OOP format. I am pretty sure a lot of my classes are violating the SRP principle, but I'm not ...
Tim Kirkwood's user avatar
-3 votes
1 answer
198 views

I'm working on a platform that consumes and transforms data to make reports and visualize those reports in a client app. The team has experience with NodeJS and NestJS, and some of us have experience ...
Mats's user avatar
  • 1
0 votes
0 answers
47 views

Motivation: I am building a webserver that is essentially a dashboard app. Users make requests and get analytics data and visualizations back. Multiple users can be in the same "workspace," ...
StarFox's user avatar
  • 101
1 vote
2 answers
133 views

Folks, I am in middle of writing a web application (Python/Flask) where home page has user profile image in the navbar which is coming from a database (blob), I am wondering if this is a good practice....
afsar's user avatar
  • 19
2 votes
2 answers
933 views

In python we use a leading _ to make object attributes implicitly "private". If we want to give people set/get access we can use the @property decorator. Or, if setting/getting is allowed ...
Alexander Soare's user avatar
5 votes
1 answer
512 views

We're working an agile project and designing as we go on a new python commandline app / systemd service for some fancy in-house project. Right now, we're supposed to be adding an observability / ...
Peter Turner's user avatar
  • 6,985
-2 votes
2 answers
356 views

I'm in the process of writing a library in Python, and I've run into a design problem concerning the use of polymorphism. I have an ABC with abstract method 'foo': class A(ABC): @abstractmethod ...
Jan van Wijk's user avatar
1 vote
0 answers
517 views

I have a Python FastAPI server application which naturally guides you towards the asynchronous paradigm. For legacy reasons, I have to support two backends, one which is purely synchronous and one ...
user3058865's user avatar
1 vote
0 answers
76 views

We currently have a backend authentication mechanism in place that utilizes JWT tokens. Users sign in or sign up using email and password, and upon successful authentication, the backend issues JWT ...
Samiksha Garg's user avatar
-2 votes
1 answer
244 views

I was tasked to create an API client library for our already existing API. I tried to research some ways how to approach this but couldn't find anything. Are there some best practices how to build ...
user3630290's user avatar
2 votes
2 answers
589 views

I have an algorithm I am trying to implement that has steps 1 to 5. There are several different ways I could implement each step. Each calculation step is essentially just an astronomy calculation, ...
Hunter's user avatar
  • 187
1 vote
2 answers
211 views

I'm developing a data pipeline in Python. We receive a variety of different types of data set that we need to process (e.g. xml, json, csv and some Excel workbooks) - where processing involves parsing ...
henryn's user avatar
  • 119
0 votes
3 answers
186 views

I am a student and am currently programming an API in Python. Among other things, it is possible to register, log in, create a user profile with data, etc. I would like to be able to store and ...
flo's user avatar
  • 1
1 vote
1 answer
106 views

I'm struggling to (integration) test a component that makes use of an infinite generator. Background: At a really high level, this component is essentially a "middleman" in a kafka workflow. ...
Luke Nelson's user avatar
-2 votes
4 answers
2k views

I need to compare versions of a software. The requirement is that I need to know if a given version is older (smaller), same or newer (higher) than another one. The version format is XX.X.XX where: ...
Marcus's user avatar
  • 129
-1 votes
1 answer
183 views

To explain what I'm trying to accomplish. Sometimes I visit website1.com, here I can download Linux ISOs but it's a bit annoying because it has a lot of ads, some of which are launched via javascript ...
Daviid's user avatar
  • 49
-3 votes
1 answer
173 views

I am designing my next project, which will do various domain-specific tasks, but all that will be controlled and used via a generic crud web app. I have been professionally using Java with Spring for ...
rafal.sz's user avatar
7 votes
1 answer
3k views

In Python there are basically two ways to get a value from a dictionary: dictionary["key"] dictionary.get("key") Is there any - maybe historical - reason for this behavior? I ...
Thomas Junk's user avatar
  • 9,623
2 votes
2 answers
1k views

Anybody have advice on splitting up a large SQLAlchemy model into smaller parts? I have a ~2000 line model called Article that is becoming difficult to manage. We often have to scroll and scroll to ...
caseym's user avatar
  • 129
2 votes
1 answer
2k views

Python is the language I use most in this period. My background in Java Before start learning Python I have programmed in Java language. In Java all code is written inside the methods of a class and ...
User051209's user avatar
0 votes
0 answers
75 views

I have made a small project to try and learn to implement SQLite-DBs into my projects. For the DB part, I use sqlmodel and followed their tutorial. For the creation of the engine however, they use a ...
Jan's user avatar
  • 251
3 votes
1 answer
220 views

I am working on a project implemented in DDD style, and I use Repository architecture pattern to persist domain changes. I have multiple roles in domain layer, and that's what raises my question - how ...
lubitelpospat's user avatar

1
2 3 4 5
41