using "private" parameters as static storage?
joe at strout.net
Fri Nov 14 03:16:25 CET 2008
On Nov 13, 2008, at 10:19 AM, Chris Mellon wrote:
> Static storage is a way of preserving state. Objects are a way of
> encapsulating state and behavior. Use an object.
Argh. I've been back in the Python community for about a month, and
I've been continually amazed at how every single "how do I do X" or
"what do you think of this method of doing X" question is answered by
people on high horses claiming "you shouldn't do X".
I know very well about state and objects. I'll be happy to whip out
my software engineering credentials and measure them against yours if
that's how you like to play. I understand very well when data should
be stored as instance data, and when it should be instead tucked away
as static data within a method. If you don't understand that, or are
happy without having the choice, and have no answer to the question I
was asking, then that's fine. I don't always have anything useful to
contribute when somebody asks a question either. But in that case, I
resist the urge to reply anyway.
Maybe we should define some standard tags people could add to the top
of their email: "Helpful-Answer" for helpful answers, and "Unhelpful-
Preaching" for the other kind. Then those of us not interested in one
sort or the other could set up an email filter.
P.S. I'm sorry, Chris, I don't mean to rip your head off in
particular. You were just the straw that broke the camels back; there
have been plenty of others adding to the frustration. I'll try to
just ignore such responses in the future... though it is a little
disturbing to think how many newbies are probably driven away by this
sort of thing.
More information about the Python-list