[Tutor] OT How to approach problem ?

Dave S pythontut at pusspaws.net
Sun May 23 05:49:19 EDT 2004

This is probarbly a Python style question ...

Having written a program to track the ftse250, I have two large lists of 
dictionaries forming 2 x 'fluid' matries. To access this data I have 
various defs which all use common pointers into the matries.

As a result I have lots of 'global' statements for each def to share 
these pointers (Cheers guys, you made it possible ;-) )

OK this works, but apparently globals are to be avoided. (Ahh ... Harp 
back to Basic + FORTH ....)

The only other way I can see is to define a class, and use self.pointer 
instead of global pointers .... Since there would only be
one instance of this class this seems a strange way to approach it.

I guess what I am asking is ... How would an experiensed Python 
programmer approach it ?


More information about the Tutor mailing list