Re: static object

2007-01-04 Thread Bruno Desthuilliers
Ben Finney a écrit : (snip) > The "Singleton" pattern does what you say here. Implementing a proper > Singleton in Python is complicated and hard to understand. Really ? Using __new__ and a class attribute, it doesn't seem so complicated - nor difficult to understand... -- http://mail.python.org

Re: static object

2007-01-03 Thread Ben Finney
meelab <[EMAIL PROTECTED]> writes: > In other words, that is a class which would result in only 1 instance > always the same no matter how many times I will "instantiate" it. The "Singleton" pattern does what you say here. Implementing a proper Singleton in Python is complicated and hard to under

Re: static object

2007-01-03 Thread Felipe Almeida Lessa
On 1/3/07, meelab <[EMAIL PROTECTED]> wrote: > I am looking for a way to create a "static object" or a "static class" - > terms might be inappropriate - having for instance: An example will speak better than me: class Card(object): __cards = {}

Re: static object

2007-01-03 Thread Gabriel Genellina
At Wednesday 3/1/2007 19:38, meelab wrote: I am looking for a way to create a "static object" or a "static class" - terms might be inappropriate - having for instance: class StaticClass: . . and then staticObject1 = StaticClass() staticObject2 = StaticClass() s

Re: static object

2007-01-03 Thread Russell Owen
In article <[EMAIL PROTECTED]>, meelab <[EMAIL PROTECTED]> wrote: > Dear All, > > I am looking for a way to create a "static object" or a "static class" - > terms might be inappropriate - having for instance: > > class StaticClass: >

Re: static object

2007-01-03 Thread Thomas Ploch
meelab schrieb: > Dear All, > > I am looking for a way to create a "static object" or a "static class" - > terms might be inappropriate - having for instance: > > class StaticClass: > . > . > > and then > staticObject1 = Stati

Re: static object

2007-01-03 Thread bearophileHUGS
That looks like some kind of singleton. Why don't you use a module instead of a class? Another solution is to define your data as class attributes. Bye, bearophile -- http://mail.python.org/mailman/listinfo/python-list

static object

2007-01-03 Thread meelab
Dear All, I am looking for a way to create a "static object" or a "static class" - terms might be inappropriate - having for instance: class StaticClass: . . and then staticObject1 = StaticClass() staticObject2 = StaticClass() so that staticObject1 and staticObjec