To create a property in a class you simply do self.property = value
. I want to be able to have the properties in this class completely dependent on a parameter. Let us call this class Foo
.
instances of the Foo
class would take a list of tuples:
l = [("first","foo"),("second","bar"),("anything","you get the point")]
bar = Foo(l)
now the instance of the Foo
class we assigned to bar
would have the following properties:
bar.first
#foo
bar.second
#bar
bar.anything
#you get the point
Is this even remotely possible? How?