Class or Dictionary?

Terry Reedy tjreedy at
Sun Feb 13 08:35:04 CET 2011

On 2/12/2011 9:20 PM, Martin De Kauwe wrote:
> On Feb 13, 5:12 am, Terry Reedy<tjre... at>  wrote:
>> On 2/12/2011 1:24 AM, Martin De Kauwe wrote:
>>> The point of this posting was just to ask those that know, whether it
>>> was a bad idea to use the class object in the way I had or was that
>>> OK? And if I should have just used a dictionary, why?
>> Did you miss my suggestion to use a module rather than a class?
>> Modules do not have some of the disadvantages of classes listed by J. Nagle.
>> --
>> Terry Jan Reedy
> Hi, sorry I did. I just re-read it, could you provide an example?

I am not sure what you are asking. tkinter.contants is one example.

> Sorry i am having a major mind blank this morning (I think this is
> obvious!?). And it would meet all of the criteria outlined by John
> Nagle?

A module will work fine if but only if you commit yourself to having all 
keys be legal Python identifiers. But that is usually not a problem with 
configuration values.

Terry Jan Reedy

More information about the Python-list mailing list