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

Popular posts from this blog

linux - Using a Cron Job to check if my mod_wsgi / apache server is running and restart -

actionscript 3 - TweenLite does not work with object -

jQuery Ajax Render Fragments OR Whole Page -