class static vs. module global

Tim Peters tim_one at
Fri Jun 25 08:38:10 CEST 1999

[Aahz Maruch]
> I have a module aC, which conveniently holds a class aC.  During some
> recent changes, I needed to share information across class instances.
> Primarily to localize things, I elected to store the information in the
> class.  Anyone want to share opinions on why I should instead have used
> a module global variable?  Or perhaps a different approach?

There's no prohibition, either technical or cultural, against using class
data in Python.  Thoroughly appropriate!  It's "class static" *methods* that
get you in trouble -- but that's all in the FAQ.

class-data-is-classy-ly y'rs  - tim

More information about the Python-list mailing list