Re: [Tutor] Scope and elegance revisited

2008-01-09 Thread Michael H. Goldwasser
On Wednesday January 9, 2008, Kent Johnson wrote: >James Newton wrote: >> Hi Python Purists! >> >> I want all instances of a given class to share a piece of information, >> but I want to set that information on the fly. I have found that this >> works: >> >>

Re: [Tutor] Scope and elegance revisited

2008-01-09 Thread Kent Johnson
James Newton wrote: > The folder in question contains images for counters for a board game. > Each player instance will use a separate counter image, but all counter > images will be chosen from the same folder. > > It looks as if the Borg pattern would make all players use the same > counter imag

Re: [Tutor] Scope and elegance revisited

2008-01-09 Thread James Newton
Kent Johnson wrote: >> To give you the context: my application allows you to select a skin for >> the user interface. I want to set the access path to the skin folder as >> a class variable, so that all instances of that class use images from >> the appropriate folder. The access path will be re

Re: [Tutor] Scope and elegance revisited

2008-01-09 Thread Kent Johnson
James Newton wrote: > Hi Python Purists! > > I want all instances of a given class to share a piece of information, > but I want to set that information on the fly. I have found that this > works: > > > class Foo(object): > # class_variable = None # There is no real need to declare this

[Tutor] Scope and elegance revisited

2008-01-09 Thread James Newton
Hi Python Purists! I want all instances of a given class to share a piece of information, but I want to set that information on the fly. I have found that this works: class Foo(object): # class_variable = None # There is no real need to declare this def __init__(self):