I have a an interface: Also there is a function in this interface: Since function in base class is pure virtual, sample Derived class is below: ...
I have a an interface: Also there is a function in this interface: Since function in base class is pure virtual, sample Derived class is below: ...
I want to use all subclasses of an abstract class in the nested config class of a pydantic class like this: The aim of it all is that I know the Ou ...
Given a 'contract' of sorts that I want to implement, I want the code to tell the reader what the intent is allow the type checker to correct me ...
I have an Event base class with a DerivedEvent. I also have BaseA with DerivedA and BaseB with DerivedB classes. The B classes have A objects in them. ...
I have written a library. Some of its functions and methods operate on sets of Hashables, e.g.: How can I define something like an UpdatableSet (an ...
Summary TLDR: Is it possible to have calling/instantiating the base class actually return an initialized subclass instance? Example Consider this A ...
This may be a total obvious error for some, but I can't seem to find out why this segmentation fault happens. I do understand that segmentation fault ...
I'm implementing a Python Interface using the abstract base class (known as the strategy pattern). I want to be able to do this with Pydantic. Withou ...
How can I ask the user to input those two numbers and print out the result in C++ here? Please, I need your help. I am new to C++. ...
So I have a load of functions which each make api calls to a service, do some processing and return something. However, there are several of these ser ...
I want to write a Settings class to load and store settings of various types: The backend has implementaions for some basic types, but not for my o ...
I'm trying to define a class that takes another class as an attribute _model and will instantiate objects of that class. I think it should be obvio ...
mypy v0.910 rejects abstract dataclasses in Python 3.9. Here's the Minimal Reproducible Example: Here's the error message: How do I get this cod ...
I'm implementing some classes for adjusting prices in my Ecommerce site: each class represents a different pricing adjustment strategy and belongs to ...
I have an abstract class written in Python: class AbsctracClass(ABC): @abstractmethod def method(self, value1: int, value2: ...
Python: 3.7+ I have a dataclass and a subclass of it as following: from abc import ABC from dataclasses import dataclass from typing import Dict, Li ...
TL;DR: Interested in knowing if it's possible to use Abstract Base Classes as a mixin in the way I'd like to, or if my approach is fundamentally misgu ...
Assume that an abstract base class MembershipClass has been created. Multiple classes are derived from the abstract base class, e.g., FirstClass, Seco ...
I am trying to refactor some old code from a beginner CS course I took in college I've noticed a lot has changed with python since then (2017) I als ...
Python's PEP 544 introduces typing.Protocol for structural subtyping, a.k.a. "static duck typing". In this PEP's section on Merging and extending pro ...