Something like this?<br><br>class User:<br>        def __init__(self, name):<br>                <a href="http://self.name">self.name</a> = name<br>        def __str__(self):<br>                return <a href="http://self.name">self.name</a><br>
n = 10<br>users = []<br><br>for i in range(n):<br>        users.append(User('user%d' % i))<br><br>print users[9]<br>print users[4]<br><br>Cheers,<br><br>Paul<br><br><br><div class="gmail_quote">On Sat, Jun 7, 2008 at 3:59 AM, Kalibr <<a href="mailto:space.captain.face@gmail.com">space.captain.face@gmail.com</a>> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">I've been developing a small script to fiddle with classes, and came<br>
accross the following problem. Assuming I get some user input asking<br>
for a number, how would I spawn 'n' objects from a class?<br>
<br>
i.e. I have a class class 'user' and I don't know how many of them I<br>
want to spawn.<br>
<br>
Any ideas?<br>
<font color="#888888">--<br>
<a href="http://mail.python.org/mailman/listinfo/python-list" target="_blank">http://mail.python.org/mailman/listinfo/python-list</a><br>
</font></blockquote></div><br>