Lacrima wrote: > Hello! > > I am newbie in python and I have really simple question, but I need > your advice to know how to do best. > I need to store a number of dictionaries in certain place. I've > decided to store them in a separate module. > Like this: > dicts.py > ----------------------- > dict1 = {....} > dict2 = {....} > dict3 = {....} > > Then, when I need any dictionary, I can access it: > import dicts > dicts.dict1 > > Is it a good practice? Or should I store them as class attributes or > anything else?
It's perfectly fine to use dictionaries as module-level objects for storing e.g. configuration-data. OTOH it's also fine to do so as class-attributes. Choosing one over the other has a lot to do with the actual problem you are working on. Diez -- http://mail.python.org/mailman/listinfo/python-list