Object help

Chris Rebert clp2 at rebertia.com
Sun Jan 11 19:00:57 EST 2009


On Sun, Jan 11, 2009 at 3:49 PM, killsto <kiliansto at gmail.com> wrote:
> On Jan 11, 2:20 pm, Steven D'Aprano <st... at REMOVE-THIS-
> cybersource.com.au> wrote:
>> On Sun, 11 Jan 2009 14:06:22 -0800, killsto wrote:
>> > I have a class called ball. The members are things like position, size,
>> > active. So each ball is an object.
>>
>> > How do I make the object without specifically saying ball1 = ball()?
>> > Because I don't know how many balls I want; each time it is different.
<snip>
>> This is the TOTALLY wrong approach.
>>
>> Instead of having named balls, have a list of balls.
<snip>
> Just curious, is there another way? How would I do this in c++ which
> is listless IIRC.

If *I* recall correctly, the STL has a `vector` type which is the
equivalent of Python's `list`.

Cheers,
Chris

-- 
Follow the path of the Iguana...
http://rebertia.com



More information about the Python-list mailing list