Linked Questions

16 questions linked to/from Dynamic inheritance in Python
0 votes
2 answers
111 views

I'm not sure that's possible, and I'm wondering if that's the way to go, or if there exists a better way of doing that. I'll create a toy example to expose what I'm looking for. Suppose I have people ...
user avatar
0 votes
1 answer
82 views

class classA: def common(self): print('A') class classB: def common(self): print('B') class classC: def workflow(self): print('Do something') self.common()...
Takkun's user avatar
  • 6,431
1 vote
0 answers
55 views

Suppose I have a class X and a class Y, is it possible to dynamically define a class that has X as a base, but also methods of Y. def combiner(base_class, derived_class): return derived_class(...
559 votes
21 answers
518k views

There seem to be many ways to define singletons in Python. Is there a consensus opinion on Stack Overflow?
529 votes
15 answers
320k views

I just started Python and I've got no idea what memoization is and how to use it. Also, may I have a simplified example?
blur959's user avatar
  • 5,649
91 votes
7 answers
60k views

This article has a snippet showing usage of __bases__ to dynamically change the inheritance hierarchy of some Python code, by adding a class to an existing classes collection of classes from which it ...
5 votes
4 answers
17k views

I am trying to pass a list of strings from one task to another one via XCom but I do not seem to manage to get the pushed list interpreted back as a list. For example, when I do this in some function ...
Guille's user avatar
  • 755
0 votes
2 answers
1k views

I'm having trouble with getting multiple dynamic inheritance to work. These examples make the most sense to me(here and here), but there's not enough code in one example for me to really understand ...
4 votes
1 answer
693 views

I have a class A. I have another class B. instances of class B should function exactly like class A, except for one caveat: I want another function available called special_method(self, args, kwargs) ...
user3180's user avatar
  • 1,517
1 vote
2 answers
1k views

I am looking for a solution to allow me to have dynamic inheritance of classes based on certain conditions being met (Python 3.6). Simple enough it seems, but I can't get the attributes of the parent ...
hubbs5's user avatar
  • 1,305
1 vote
1 answer
1k views

I found this post where a function is used to inherit from a class: def get_my_code(base): class MyCode(base): def initialize(self): ... return MyCode my_code = get_my_code(...
1 vote
0 answers
346 views

How can one add dynamically a new parent class in python to an existing object? class A: def doA(self): print('A::doA') class C(A): pass c = C() # class 'B' is created after object 'c' class B:...
S.V's user avatar
  • 2,855
2 votes
1 answer
178 views

After much searching, the only way I have found to solve my particular problem is to use dynamic inheritance. It is easy enough following the guide from here and a few other SO questions; most table ...
1 vote
1 answer
221 views

The best way to explain this, I guess, is by example. Writing a game, have a parent class for all character classes that establishes the basic methods and values, with a whole horde of child classes ...
0 votes
0 answers
63 views

Is it possible to choose which base class to inherit from at the time of object creation? Basically, different objects of the same class will make the class inherit from different base classes ...

15 30 50 per page
1
2