Python Dynamic Class Object Names
<p>Just a quick question. I've tried Googling this but every time you add "class" to a Python search it gives you classes on Python. D:</p>

<p>I've found threads like this: <a href="http://stackoverflow.com/questions/5036700/how-can-you-dynamically-create-variables-in-python-via-to-a-while-loop">How can you dynamically create variables in Python via to a while loop?</a></p>

<p>But I don't think that's exactly what I'm looking for since concatenation is also part of the variable.</p>

<p>Here's my while loop:</p>

<pre><code>def main():
    counter = 1
    while counter &lt;= 3:
        print "Name: ",employee[counter].name
        print "ID Number: ",employee[counter].id_number
        print "Department: ",employee[counter].department
        print "Job Title: ",employee[counter].job_title
        print #LB
        counter = counter + 1

main()  
</code></pre>

<p>I have my objects set up as:</p>

<pre><code>employee1 = Employee("Susan Meyers", 47899, "Accounting", "Vice President")
employee2 = Employee("Mark Jones", 39119, "IT", "Programmer")
employee3 = Employee("Joy Rogers", 81774, "Manufacturing", "Engineer")
</code></pre>

<p>This is the error I receive:</p>

<pre><code>print "Name: ",employee[counter].name
NameError: global name 'employee' is not defined
</code></pre>

<p>Obviously I have a class set up as well, but I don't think I need to paste that for this. What I want it to do is go through the loop and change the counter from 1 to 2 to 3. That way it'll loop through all three employees. </p>

<p>Is it possible to do that? I've only ever done this with arrays so I'm not 100% sure I'm on the right track.</p>

<p>Any tips would be great. &lt;3</p>

<p>Chelsea</p>
