jervisau at gmail.com
Sun Jan 11 23:17:46 CET 2009
On Mon, Jan 12, 2009 at 9:06 AM, killsto <kiliansto at gmail.com> wrote:
> I would think something like:
> def newball():
> x = last_named_ball + 1
> ball_x = ball(size, etc) # this initializes a new ball
> return ball_x
> But then that would just name a ball ball_x, not ball_1 or ball_2.
> Is it possible?
How about placing the balls in a python list:balls = [Ball() for i in
where number_of_balls is the number of balls you want to create.
additional balls can be added to the list:
now you can access the balls like so:
< __main__.Ball instance at ...>
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-list