In article <hoihgt$p6...@reader1.panix.com>, kj  <no.em...@please.post> wrote:
>
>What's the word on using "classes as namespaces"?  E.g.
>
>class _cfg(object):
>    spam = 1
>    jambon = 3 
>    huevos = 2
>
>breakfast = (_cfg.spam, _cfg.jambon, _cfg.huevos)

There is one gotcha associated with using classes as namespaces: you have
to be careful to avoid instantiating them.  That goes triple if you
modify the class attributes, because modifying an attribute in an
instance does *not* propagate the change to the class.
-- 
Aahz (a...@pythoncraft.com)           <*>         http://www.pythoncraft.com/

"It is easier to optimize correct code than to correct optimized code."
--Bill Harlan
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to