A class instance initializing with previously inititalized attributes
<p>I have a slight complication with my code. I want the pirate attribute to take the value True if the other two attributes are higher than some number when summed up and multiplied by some factor.</p>

<p>For instance, maybe I want the pirate attribute to be True only if social*0.6 + fixed is greater than 5, and false otherwise.</p>

<pre><code>import random

class consumer(object):
"""Initialize consumers"""
    def __init__(self, fixed, social,pirate):
        self.social = social
        self.fixed = fixed
        self.pirate = pirate

"""Create an array of people"""
for x in range(1,people):
    consumerlist.append(consumer(random.uniform(0,10),random.uniform(0,10),True))
    pass
</code></pre>

<p>In response to Moses answer: Using a calculated property is safer than calculating the pirate value at initialization only. When decorating a method with the @property attribute, it acts as a property (you don't have to use brackets as is the case for methods), which is always up to date when the social member is changed afterwards.</p>

<pre><code>class Consumer(object):

    def __init__(self, fixed, social):
        self.fixed = fixed
        self.social = social

    @property
    def pirate(self):
        return self.social * 0.6 + self.fixed &gt; 5

consumer1 = Consumer(1, 12)
print("Value of pirate attribute: " + str(consumer1.pirate))
</code></pre>

python