Skip to main content
-2 votes
1 answer
62 views

import dataclasses @dataclasses.dataclass class MyClass: a: int b: int = dataclasses.field(default=0, init=False) m = MyClass(a=0) print(repr(m)) # prints: "MyClass(a=0, b=0)" # `...
Guti_Haz's user avatar
  • 2,752
3 votes
1 answer
70 views

I am writing a Python config script that creates an array of input files in a domain-specific language (DSL), so my use case is a bit unusual. In this scenario, we want medium-level users to be able ...
globglogabgalab's user avatar
0 votes
0 answers
31 views

I have a data class: from dataclasses import dataclass from typing import Any @dataclass class Url: http: bool params: dict[str: Any] body: str # More stuff here Here I have a Url ...
Aadvik's user avatar
  • 1,522
2 votes
2 answers
91 views

I have the following simple class in Python: class Point: def __init__(x: int, y: int | None = None): self.x = x self.y = y if y is not None else x How can the same thing be ...
Dominik Kaszewski's user avatar
0 votes
1 answer
46 views

I'm trying to convert a json array to a Python list of typed objects. It's data from Teltonika FOTA The call result_list = fromlist(FotaDevice, intermediate_list) is failing with the error message ...
Hecatonchires's user avatar
4 votes
3 answers
158 views

I'm currently working with a dataclass (defined in one of the dependencies I'm currently working with inside of my project), which is defined similar to this snippet: from dataclasses import dataclass ...
Jaime 's user avatar
  • 143
1 vote
2 answers
122 views

I am building a small python application to learn Domain-Driven-Design (DDD) approaches. Therefore I am using a dataclass/attrs class as my domain model and also use this class to imperatively model ...
5th's user avatar
  • 2,515
1 vote
1 answer
103 views

In Python, I am using dataclass with the following class hierarchy: from dataclasses import dataclass @dataclass class Foo: id: str @classmethod def fromRaw(cls, raw: dict[str, str]) -> '...
hvtilborg's user avatar
  • 1,487

15 30 50 per page
1
2 3 4 5
70