Chris I take good notice of your comments and suggestions. Thanks.
--
http://mail.python.org/mailman/listinfo/python-list
Thanks MRAB and Peter Otten that solved the problem.
--
http://mail.python.org/mailman/listinfo/python-list
On Sat, Aug 28, 2010 at 10:48 AM, cocolombo wrote:
> Hello.
>
> I am putting objects (test) into a container object (tests) and the
> test object is also a container for a another list of object
> (scores).
>
> Problem is that all instances of class tests have the same value.
>
> To illustrate:
>
cocolombo wrote:
> Problem is that all instances of class tests have the same value.
>
> To illustrate:
> class tests(object):
> listOfTest = []
This makes listOfTest a class attribute. To get one list per instance define
it in the initializer:
class Tests(object):
def __init__(self):
On 28/08/2010 18:48, cocolombo wrote:
Hello.
I am putting objects (test) into a container object (tests) and the
test object is also a container for a another list of object
(scores).
Problem is that all instances of class tests have the same value.
To illustrate:
class score(object):
va
Hello.
I am putting objects (test) into a container object (tests) and the
test object is also a container for a another list of object
(scores).
Problem is that all instances of class tests have the same value.
To illustrate:
class score(object):
val = 0
def __init__(self, val):