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.
2,034 questions
1
vote
1
answer
27
views
Multi processing or multi threading for pywinauto?
I am trying to automate an old GUI tool which requires filling in some data from a CSV and selecting appropriate tree item values based on it. I need to do this in multiple instances of the ...
2
votes
1
answer
168
views
Serving several external APIs in Django + Angular application
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 ...
3
votes
6
answers
603
views
Is OOP really beneficial for enterprise-scale business software compared to procedural languages like ABAP or COBOL?
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 ...
3
votes
2
answers
264
views
How to structuring a read/write submodule in OOP Python
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 ...
4
votes
2
answers
502
views
Control flow and communication with two separate frontends (maybe with exceptions)?
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 ...
0
votes
2
answers
433
views
How to implement a server application that can reload configuration without restart
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 ...
5
votes
5
answers
715
views
How to test for performance regression?
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 ...
5
votes
2
answers
736
views
Why did Python designers decide not to declare vars? [closed]
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
...
0
votes
0
answers
71
views
Simple packaging for multi-file/module Python deployments
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 ...
1
vote
1
answer
359
views
Separation of concerns between business layer, data layer and presentation layer without losing information
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 ...
2
votes
1
answer
147
views
A Design Pattern for a component which both writes to and reads from an ordered event log
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 ...
7
votes
2
answers
726
views
When the stack frames become computationally expensive
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 ...
0
votes
1
answer
210
views
Serving part of a web application as a python package for people to install, ok to do?
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 ...
3
votes
1
answer
610
views
Object-oriented programming design with relational database tables
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 ...
1
vote
3
answers
868
views
Architecture to avoid circular imports in Python, specifically a flask server
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 ...
-3
votes
1
answer
198
views
Is it a bad idea to use NodeJS + Python for back end development? [closed]
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 ...
1
vote
2
answers
133
views
Dynamic web application hitting database on front page load to fetch profile image
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....
5
votes
1
answer
512
views
How does one add observability to python code without affecting code quality?
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 / ...
1
vote
0
answers
520
views
How to structure your Python code with asynchronous and synchronous parts
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 ...
-2
votes
1
answer
245
views
Are there some best practices how to build a client library for an API?
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 ...
1
vote
2
answers
211
views
Using an instance method or a function with conditional logic based on type
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 ...
1
vote
1
answer
106
views
How to test integration with an infinite generator
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. ...
-1
votes
1
answer
183
views
How to structure a modular MITM proxy with python
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 ...
7
votes
1
answer
3k
views
Why are there two ways to retrieve values from a dictionary in Python?
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 ...
2
votes
1
answer
2k
views
In Python when is absolutely preferable to use a class instead of a module?
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 ...