Design question.

Lacrima Lacrima.Maxim at gmail.com
Mon Jul 20 08:44:22 EDT 2009


On Jul 20, 3:31 pm, "Diez B. Roggisch" <de... at nospam.web.de> wrote:
> 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

Hi!

Thank you very much for your so soon reply!

With regards,
Max



More information about the Python-list mailing list