Luis N wrote:
> On 7/19/05, *Kent Johnson* <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>> 
> wrote:
> 
>     Luis N wrote:
>      > I'd appreciate some comments on my use of globals and the map
>     function.
> 
>     I don't see the need for the global declaration; desc, vw,
>     primaryKey are all assigned within this function and returned to the
>     caller.
> 
> In this case consider desc, vw, and primaryKey to be of the same 
> importance as dbs, other functions must access them in a way that 
> renders their being local impossible, unless the logic where to be 
> encapsulated in a class, which didn't seem necessary.

If you have several functions in one module that need access to the same 
variables, that is a good indication that using a class might be a better 
design. OTOH using a module to encapsulate the state (as globals) is OK if you 
only need one set of globals.

Is there something that bothers you about using globals? I'm not sure why you 
asked for comments.

Kent

_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to