Is it a good idea to dynamically create variables?

I think it’s preferable to use a dictionnary if it’s possible:

vars_dict = {}
vars_dict["my_variable"] = 'Some Value'
vars_dict["my_variable2"] = 'Some Value'

I think it’s more pythonic.

Leave a Comment