Assuming i have a class that implements several methods. We want a user to chose to which methods to run among the exisiting methods or he can decide to add any method on_the_fly.
from example
class RemoveNoise():
pass
then methods are added as wanted
RemoveNoise.raw = Raw()
RemoveNoise.bais = Bias()
etc
he can even write a new one
def new():
pass
and also add the new()
method
RemoveNoise.new=new
run(RemoveNoise)
run()
is a function that evaluates such a class.
I want to save the class_with_the_methods_used and link this class to the object created.
Any hints on how to solve this in python?
Functions can be added to a class at runtime.
class Foo(object):
pass
def bar(self):
print 42
Foo.bar = bar
Foo().bar()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With