class static vs. module global

Tim Peters tim_one at email.msn.com
Fri Jun 25 02:38:10 EDT 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