python - How to name class instances after an iterable keys? -
i'd create instances of classes getting names list values or dictionaries keys or values. i'd is:
iter = ['foo', 'bar'] in iter: = cls()
and foo , bar instances of cls() class instead of having instance referenced updated @ each loop.
thanks in advance.
maybe dictionnary :
iter = ['foo', 'bar'] result = {} in iter: result[a] = cls()
and in result you'll have { 'foo' : instance_of_cls, 'bar' : instance_of_cls}
Comments
Post a Comment