How to make a Protocol that inherits methods and attributes from a concrete class
Scenario I have a Foo protocol: class Foo(Protocol): fooname: str def do_fooey_things(self): pass and a bunch of different types of concrete Foos: class PurpleFoo: fooname: str = “purple” def do_fooey_things(self): print(“purple foo!”) What I’ve achieved with this is a way of being able to type-hint, have my IDE help me, and run tests to make […]
Decorator / functionality for inheriting an arbitrary number of classes
I want to create functionality for a data class to be able to inherit 0..N mix-ins in Python whilst still returning the original data class object.
Appending class object to a list removes its methods
How do I make my shuffle method work better?