I have a program that generates many instances of a class with an attribute
self.x = random.gauss(10, 2). So each instance has a different value for
self.x. This is what I want. Now I want to make a class that starts my
program and sets the attributes.
class people:
    def __init__(self, size)
        self.size = size

class makepeople:
    def __init__(self, randomsize)
        self.rsize = randomsize
        self.allpeople = []
    def makethem():
        for x in range(1,100):
            p+str(x) = people(self.rsize)
            allpeople.append(p+str(x))

so what I would like to have work is set the attribute of makepeople so that
when it is used to make instances of people each will have a different size.

listofp = makepeople(random.guass(100, 2))
listofp.makethem()

I would then what listofp.allpeople to be a list of people with different
sizes. The above code does not work, I don't think it does anyway.

I hope this makes sense, I am sure there is a term for what I am trying to
do but I don't know it.

Thanks
Vincent Davis
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to