Bob Gailer wrote:
Andre Engels wrote:
Is it possible to define a class in such a way, that if twice an
object is made with the same initialization parameters, the same
object is returned in both cases?
Use a "factory" function, and store a dictionary of instances as a
Andre Engels wrote:
> Is it possible to define a class in such a way, that if twice an
> object is made with the same initialization parameters, the same
> object is returned in both cases?
>
Use a "factory" function, and store a dictionary of instances as a class
property:
class myObj(object)
On Mon, 24 Apr 2006, Andre Engels wrote:
> Is it possible to define a class in such a way, that if twice an object
> is made with the same initialization parameters, the same object is
> returned in both cases?
Yes. The idea is to have the "constructor" really be a function that
delegates o
Is it possible to define a class in such a way, that if twice an
object is made with the same initialization parameters, the same
object is returned in both cases?
More specifically, suppose I have the following program:
class myObj(object):
def __init__(self,a):
self._a = a
s