[Tutor] creating objects in a loop

Alexandre Ratti alex@gabuzomeu.net
Wed, 03 Apr 2002 10:45:51 +0200


At 23:09 02/04/2002 -0500, you wrote:
>Date: Tue, 2 Apr 2002 22:41:11 -0500
>Subject: Re: [Tutor] creating objects in a loop
>From: Erik Price <erikprice@mac.com>
>
>On Tuesday, April 2, 2002, at 03:16  PM, Kirby Urner wrote:
>
> > Filing your multiple objects in a dictionary or list
> > is usually better than creating a lot of top level
> > variables in the namespace.
>
>Is this for tidiness reasons (to avoid cluttering the namespace with
>unnecessary names), or is this convention?

In my understanding, this is for tidiness. It will help avoiding name 
clashes that might create bugs in your program. If several methods / 
functions modify a global variable, you may find it difficult to know what 
its current status is.

[Terminology note: is this what programmers call "side effects"?]


Cheers.

Alexandre