Skip to main content

Question list filters

Filter by
Sorted by
Tagged with
Score of 1
1 answer
55 views

I'm writing some code that I want to make use of lazy imports, which were introduced in Python 3.15. However, I want the code to run fine on Python < 3.15 too, albeit without lazy imports. Just ...
Score of -4
0 answers
52 views

Is there a way to make multiple copies of a class without specifying the variable name? Like how scratch has a "make clone of self" block. What I want is for there to be multiple items, so I ...
Score of -14
0 answers
63 views

how do I exactly use match-case because I need it but sadly, I don't know/ remember how to use them. Could someone please kindly explain?
Score of 5
2 answers
89 views

I have these two attrs classes in Python: import attrs @attrs.define(frozen=True) class FooA: x: int @attrs.define class FooB: x: int = attrs.field(on_setattr=attrs.setters.frozen) In #1, ...
Score of -1
2 answers
107 views

Consider the following class Point and its metaclass PointMeta. What happens if I omit the super call in __init__ method of PointMeta class, is there any difference in behavior? class PointMeta(type): ...
Score of 2
1 answer
115 views

I'm learning how to capture video from camera using opencv for Python. The official tutorial provides the following example (modified): import cv2 as cv cap = cv.VideoCapture(0) if not cap.isOpened():...
Score of -4
0 answers
110 views

I am a Computer Science student working on a project that analyzes dog barks to determine the underlying emotion. Aside from the complex data collection process (recording barks and their associated ...
Score of -5
1 answer
214 views

According to Wikipedia: Python 3.0 was released on 3 December 2008, and was a major revision and not completely backward-compatible with earlier versions, with some new semantics and changed syntax. ...
Score of -8
0 answers
42 views

In Python, when I create a nested list with grid = [[0]] * 3 and then run grid[0][0] = 5 or grid[0].append(1), the change appears in all three inner lists at once, even though they print as three ...
Score of 4
3 answers
158 views

The Python 3.14 docs say annotations are now evaluated lazily, so forward references work without from __future__ import annotations. I removed that import from my mini ORM. Now defining any model ...
Score of -3
1 answer
161 views

This Pyglet program doesn't seem to understand the key function and gives a NameError every time it runs. Does anyone know a solution to this? import random import pyglet p=0 de=0 #opens window window ...
Score of -9
0 answers
217 views

company1 = ['10', '11', '13', '15', '17', '19', '20'] company2 = ['20', '21', '23', '25', '27', '29', '30'] company3 = ['40', '41', '43', '45', '47', '49', '50'] The lists (company1, company2, ...
Score of -2
1 answer
134 views

I'm practicing on how to develop python programs with graphical interfaces, but the issue is the following: when I double click the program it works fine, but when I try to execute it in the terminal ...
Score of 3
1 answer
244 views

I'm developing a Python application that stores scheduled events using timezone-aware datetime objects. I encountered an unexpected behaviour when handling Daylight Saving Time (DST). from datetime ...
Score of 3
1 answer
210 views

I am working with a standard FrenchDeck class. This is the exact example from the book Fluent Python: import collections Card = collections.namedtuple("Card", ["rank", "suit&...

15 30 50 per page
1
2 3 4 5
…
146951