Skip to main content

Questions tagged [python-3.x]

Python 3 is the latest version of the Python programming language and was formally released on December 3rd, 2008.

5 votes
2 answers
740 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
-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
3 answers
630 views

I have reviewed this, but it doesn't seem to address what I'm asking here. https://stackoverflow.com/questions/15727420/using-logging-in-multiple-modules I want to have multiple programs call the same ...
NealWalters's user avatar
1 vote
0 answers
66 views

As a toy problem for learning Django, I am trying to create a simple web app that tracks encounters and initiative for one of my D&D campaigns. I have a database with models for combatants: class ...
Brandon Smith's user avatar
2 votes
3 answers
458 views

This is a conceptual question about whether my specific use-case warrants the use of an asynchronous API. Language: Python 3.11 Framework: FastAPI (ASGI) I believe I am confused about what an ...
nonohat's user avatar
  • 53
0 votes
2 answers
361 views

I'm using argparse.ArgumentParser extensively; however, it comes with a lot of boilerplate to set up, and this is especially noticeable when you've got more than a few common arguments that probably ...
g_elef's user avatar
  • 19
0 votes
1 answer
238 views

I am currently developing an application in Python that has a match making functionality to form sports teams of 4 and group them by skill. The following has been implemented and works. E.g. Form ...
serge's user avatar
  • 9
1 vote
0 answers
95 views

I have the following piece of code. Line 1 is a container (for simplicity, one can think of it as a list of elements e1, e2, ..., en). Now there is a function function_fun which takes as input an ...
A J's user avatar
  • 19
2 votes
2 answers
170 views

Consider the following python3 code: from abc import ABC, abstractmethod class Food(ABC): _food_factory_map = {} _recipes = {} @classmethod def getFood(cls, foodName): return ...
raghavj's user avatar
  • 29
1 vote
2 answers
1k views

I'm working on a python library for a REST API.I'm using python data classes to represent the structure of the returned JSON The v2 of this API returns a slightly different object when compared to v1. ...
rsn's user avatar
  • 127
1 vote
0 answers
1k views

I'm working on a python wrapper for a REST API. I'm using python data classes to store the shape of the JSON response of each endpoint so developers have features like autocomplete and objects they ...
rsn's user avatar
  • 127
21 votes
6 answers
7k views

In Python 3, I subclassed int to forbid the creation of negative integers: class PositiveInteger(int): def __new__(cls, value): if value <= 0: raise ValueError("value ...
swoutch's user avatar
  • 321
-2 votes
1 answer
91 views

Here's what I want to achieve: while complex_compound_condition_statement: foobar() # ... do some stuff I would like the log output of the above to be: <timestamp> INFO: started doing stuff ...
user247243's user avatar
2 votes
1 answer
4k views

I have a class that I use to define different types of plots I am performing class MyPlots(Enum): STANDARDSCALE = "standard" LOGSCALE = "log" there are default values ...
La Cartuccia's user avatar
5 votes
1 answer
365 views

I am a very beginner writing one of my first webapps. I'm using FastAPI and I'm stuck on the logic of creating an endpoint that has to do a lot of things before it returns something back to the user. ...
Jinx's user avatar
  • 159

15 30 50 per page
1
2 3 4 5
11