static keyword

Steve Simmons scs at lokkur.dexter.mi.us
Fri Apr 30 11:09:27 EDT 2004


Peter <peter at engcorp.com> wrote on 04/29/04 at 14:37:

> I'm not sure how to interpret the smiley, but I'll take it
> you weren't actually joking...

> Why do you call using OO ("wrapping it in a class", as you say)
> a "hack"?  Generally speaking, using objects to contain state
> information such as this is exactly what most people would call
> the cleanest, best approach.

I'm not the original poster, but I'm going to side with him.

Class, to me, implies a fair number of things about the intended
use of what the author has written.  Jacobson is talking about
a much simpler construct/feature than what one would normally
use a class for.  His proposal might seem like mere syntactic
sugar to avoid making a class, but IMHO it will lead to code
that is more readable - code that doesn't imply it's anything
other than a function with a persistant, stateful variable.

Steve



More information about the Python-list mailing list