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
-5
votes
0answers
21 views

I want to find data and print it from a website in Python [closed]

I want to be able to retrieve text data of the moon's phase from a website in python and then print it. How do I do this?
0
votes
0answers
30 views

Approach to setup multi-tenant RabbitMQ workers in Python

I'm migrating my current application to multi-tenant setup. Now I've multiple rabbitmq workers to process async job, publish and consume integration events, and other stuffs. I'm planning to use ...
2
votes
4answers
215 views

Is it a good idea to start a function with a bunch of assert statements?

Sometimes when I look at other people's code I see functions that make a bunch of assumptions about the inputs but do not explicitly assert their assumptions. For example, look at the code below: def ...
-1
votes
0answers
32 views

Developing with GPIO on Raspberry Pi

I'm working on a project that utilizes the GPIO pins of the Raspberry Pi. I prefer developing on my laptop but when I'm testing I have to run the software on the Raspberry Pi. I'm using git as my ...
-2
votes
0answers
17 views

I want to one Goal to have different Dates and Checks, how should i structure the relationships?

This is the models.py file from django.db import models This are the choices i want to have # Create your models here. DISPLAY = [ ('Done', 'Done'), ("Didn't do", "Didn't do"), ] this is the ...
-1
votes
2answers
126 views

When should I use a database instead of a list? [duplicate]

New to Python and all things database related. Wondering when I should consider using a database and why? I have what is essentially a list of objects that is around 30000 lines long. I'm developing a ...
0
votes
1answer
75 views

What is the space complexity of a Python dictionary?

If python dictionaries are essentially hash tables and the length of hashes used in the python dictionary implementation is 32 bits, that would mean that regardless of the number of key-value pairs ...
-1
votes
1answer
40 views

Resolving Dependencies and Incompatibilities Deterministically

Problem Description I'm working in Python and I've been having a problem designing something to handle the following (abstracted) system: I have some objects (lets call them Nodes) that can be in ...
0
votes
1answer
88 views

Mixing IoC container use with “poor mans” DI

I'm finding the use of IoC containers to be quite the shift in my application design, and its for the better. I'm using a framework called injector that aims to mimic (albeit not entirely) the Guice ...
1
vote
2answers
60 views

Best way to enforce variable has certain values using enum in Python

I have a string variable named status in my code that can take on three values "Starting", "In-progress", and "Complete". A friend of mine said it was good practice to enforce that status has one of ...
-4
votes
1answer
41 views

Question about the tutorial purgatory in coding path

Dear all the programmers and overflow friend, First, I want to say thank you to stack overflow users for helping me finish 20% of my PhD project since last year (using python to draw some technical ...
5
votes
3answers
144 views

Approach for updating status of a function

When I call a function, I want to receive updates when the function reaches some milestones: def do_something(): start_with_something() # update for x in iterate_something(): # ...
1
vote
0answers
28 views

Optimal package structure - Command Line Interface

I have an ongoing project where the directory structure currently is a mess (github Directory) and I would like to strucure it to eventully create a python package out of it. Below I have outlined a ...
-3
votes
1answer
47 views

What is the rule for making functions private in Python modules?

I was wondering what's the principle behind it, and whether I should treat all functions from module that are not used anywhere else at the time as private, and mark them with underscore prefix so ...
0
votes
1answer
38 views

What's a proper way to call a chain of methods that modify an instance attribute?

I've got an Algorithm class whose responsibility is to find if a given word is in a list of words. As part of doing that, the algorithm first has to lowercase the words, remove punctuation, and ...
4
votes
2answers
260 views

What's wrong with using a Singleton?

I'm working on a Python application in which there are two Singleton classes: App and Configuration. The former seems straight forward, only ever instantiate one App instance; the latter seems ...
-4
votes
0answers
11 views

How to print content of Qt Widget Python PyQt5

I have scrollarea in which i have widgets that contain charts and tables, i want to print them..
0
votes
1answer
39 views

Is it possible to have a function executed when a specific exception is raised anywhere in the program?

I want to add some custom retry logic to the AWS sdk (but this isn't specifically about that). So whenever it throws a specific network exception it waits and tries again and whenever it throws a ...
0
votes
0answers
25 views

How to approach the lack of labels variability in a dataset for a RNN model?

I'm working on a quality air index model prediction from certain city. I have a dataset composed of hourly pollutants readings (5) from up to 24 basestations. Not all basestations can read all 5 ...
-4
votes
0answers
21 views

Python versions and binaries : /usr/bin vs /usr/local/bin

I am getting myself started with Python development on a Debian OS. I had python 2.7 and 3.5 installed. I decided to install Python 3.8 (from source code). Now, if I do a whereis python, I get : ...
-3
votes
0answers
19 views

pip install Tensorflow: Exception, what should I do?

I'm trying to install TensorFlow on my computer, but I can't because of this following error: plus, I ran it as an administrator, and the operating system is Windows 10, prompt is cmd. and my computer ...
-2
votes
1answer
48 views

Designating a pin header and a GPIO

I have an Acconeer XB112 breakout board and an XM112 radar module. It all works just fine per the Acconeer documentation and tutorials. Now I want to modify some of the code to output to a GPIO. ...
0
votes
1answer
33 views

Scraper in separate repo from visualization component?

Let me explain my thoughts about architecture of the project I'm working on. The project code repository consist of: Scrapy component - of course it serves to scrape data, process it and calculate ...
-1
votes
2answers
76 views

How to Maintain Rarely Used Scripts

I come across the need to do a lot of one time scripts (related to API evaluations, data extraction, experiments etc.) that have the potential only to be used very rarely in the future. These could be ...
-2
votes
1answer
71 views

Depending on fairly big modules to do just a simple operation

So I have a website which does a bunch of different stuff, more importantly, it allows the user to upload videos. Now unfortunately videos are a bit annoying as they need a poster img to display ...
2
votes
1answer
82 views

Python: Return or update object

Firstly I am new to Software Engineering and my last question was closed. I am doing my best to ask relevant questions and improve. If you are going to down vote my question I'd really appreciate if ...
-4
votes
1answer
57 views

Is it better (from a maintenance perspective) to dynamically construct complex SQL queries using Jinja or String concatenation? [closed]

Two possibilities. Which is better, with respect to readability, maintenance and clean code: SQL injection can be disregarded. Constructing complex parameterized sql queries using python string ...
-4
votes
1answer
31 views

How would I authenticating a Software Plugin with Username/Password using REST?

I'm developing my first Python plugin for a 3D application. What I'm looking to do I would like users who've purchased a subscription to the plugin from my Wordpress/WooCommerce web site to log in ...
2
votes
1answer
59 views

How to visualise multiple similar classes in an UML class diagram?

My question is about an "edge case" of the UML class diagram. In particular, I have loads (about 30) classes that implement an interface. They can be split into two groups of similar classes. Within ...
3
votes
3answers
150 views

How can I improve the speed of scanning multiple directories recursively at the same?

So I am trying to speed up my program by using concurrency and/or multi-threading and/or process parallelism. The topics are pretty complex and I am sort of new to them so I am still trying to figure ...
0
votes
1answer
35 views

Packaging a python project which requires non-python packages

I'm following the python documentation about "distributing packages using setuptools". It doesn't mention what to do if a python package you want to include in your install_requires requires a system ...
0
votes
0answers
30 views

Is it idiomatic to use protobufs as containers within a service?

I love gRPC, but I find every step of the protobuf process rather frustrating (particularly in Python). Even though they are structurally similar to data structures composed of lists and dicts, you ...
1
vote
0answers
26 views

Combine/Sync Amazon S3 and MongoDB Atlas with Elastic Search

I have many continuously growing (through scrapping) collections in MongoDB Atlas. The documents in each collection follows the following schema: { "source_url": "<some url on the web>", "html":...
5
votes
0answers
98 views

Fortran-Python Interface

Disclaimers: This question is reposted from SO upon SO user's suggestion to put it here since there is no specific code in question. This question is a subset of my larger theme of Fortran ...
2
votes
1answer
67 views

How to simplify a complex factory pattern?

I have a function which takes the incoming request, parses the data and performs an action and posts the results to a webhook. This is running as background as a Celery Task. This function is a common ...
0
votes
1answer
85 views

To structure big and expandable project(s)

TLDR with bold I want to create a library (I think this is the right term) for my own reinforcement learning environments (envs for short). Most of the envs would be based on self-implemented games ...
0
votes
0answers
31 views

Inheritance and instance-storage design suggestions in Django system

I am learning Django and to make the most out of the educational process I am thinking of this hypothetical system and tries to figure out how I would design and implement it. The hypothetical system ...
-4
votes
1answer
43 views

How should I name a function that prints packet loss and returns it? [closed]

Currently it is named print_statistics and it prints packet loss.
3
votes
1answer
30 views

Best way to go about including C/C++ dependencies in Python packages?

I would like to include fastparquet as a dependency in a Python library I am working on but it requires Microsoft Visual C++ to build. The goal here is for the end user to be able to easily install my ...
-1
votes
3answers
117 views

Software components tightly coupled or loosely coupled- simple case examples

Imagine you have software component named A which knows component B Lets say knowing each other is via reference or imports, or two of them. Is it safe to tell the following statements: 1. A-->B ...
-1
votes
2answers
144 views

Will compiled python code be as fast as compiled C++ code?

I know that Python is an interpreted language and that c++ is a compiled one, or at least I like to think that I've understood some of their differences. Although C++ is apparently faster than ...
0
votes
4answers
205 views

Design pattern for a function class

I have been experimenting with the idea of function classes as explained in this article and Composition applied to function dependencies as described in the following questions: https://...
-2
votes
1answer
60 views

pep8 (D103) I need docstrings for my unit test functions too?

Perhaps im not defining my pytests right but im seeing this: Does pep8 demand a docstring for each unit test function too? I cant find pep8 docs specific to this, wondering if pep8/flake8 is unit ...
-2
votes
1answer
63 views

Choosing between perl and python for my application [closed]

I am working for a small electronics company and I was assigned a task of re-inventing and re-writing the software for our product delivery flow, which gathers design components, verifies them, and ...
1
vote
2answers
114 views

Chat part of application - using UDP or TCP?

I'm trying to build a section of my app where two users can message each other. I've read about TCP and UDP and it seems like TCP is more suited due to ordered packet delivery. However, TCP requires a ...
1
vote
1answer
75 views

Choosing a suitable design structural pattern for a use case

I have the following models. First, there is a Vector which has a circular DNA sequence. Second, there is a LinearizedVector which could one of below classes. LinearizedVectorBase: ...
0
votes
1answer
59 views

Unpacking python dictionaries, or list comprehension, or …

my_dict = { 1: 11, 2: 12, 3: 13 } If I want to work on the list of keys from my_dict there appear to be (at least) three ways to do this in Python >3.5 (i.e. on or after PEP 448) List Comprehension: ...
7
votes
2answers
272 views

Should examples for functions be unit tests?

I'm writing a python function to replace all the non-alphanumeric characters in the keys of this dictionary with underscores. To make sure it's working as expected as I don't have a ton of ...
0
votes
0answers
32 views

Exchange data between python and angular with flask

I am trying to determine which is the best arquitecture to my application, I am planning to use python, mysql, angular and flask as an intermediate between python and angular. I have all the shots of ...
0
votes
0answers
20 views

Python - Options for accessing class attributes/methods from other classes while keeping classes encapsulated?

I'm teaching myself python and am working on a space invaders clone. Pretty much everything is working as I want it to. But I'm also trying to teach myself good principles of object-oriented design. ...

1
2 3 4 5
34