Re: Recursion script which doesn't?
Re: Recursion script which doesn't?
- Subject: Re: Recursion script which doesn't?
- From: Paul Berkowitz <email@hidden>
- Date: Fri, 06 Apr 2001 16:22:16 -0700
On 4/5/01 3:19 PM, "Charles Arthur" <email@hidden> wrote:
>
> I'm not sure if using 'lastrundate' as a parameter instead of a global is
>
> actually more efficient, but it's generally considered to be better
>
> practice.
>
>
Could I be tedious and ask particulary why?
Well, this will be interesting. There are people, including some real
experts here, who believe that globals are dangerous, but I've never
understood why. It seems to be something taught in computer classes that
stick with people to the ends of their lives, just like the things that your
parents told you were "bad" when you were 5 years old. I've been wondering
if it's really no more than a superstition and habit, since I've never seen
anything bad result from using globals.
What I do see is that the general principle of Occam's razor - in this case
"why use a blunderbuss when a penknife will do?" - would apply here. If you
just need to refer to a variable in one or two handlers, why make it apply
everywhere? (Although I still don't see what harm it does, normally, it does
"feels neater" just to use it where necessary.) I have used globals to good
effect when accumulating lists in repeated iterations of many different
handlers - although even there you can pass the list back and forth as a
parameter (to) and "return" (from) the handlers instead if you prefer.
--
Paul Berkowitz