Arnold Dent Arnold Dent - 1 year ago 68
Python Question

Automatic varable creation when when adding new instance of a class

I am teaching my self Python, and I am getting my head around OOP classes. I keep seeing examples like this.

import ClassImade

var1 = ClassImade()
Var2 = ClassImade()

The program I am trying to make will have several thousand instances of the class. My question is: how has this issue been over come? I have seen in other posts that this is part of bad construction of the program. if that is so why do I keep seeing it over and over again in examples?

Answer Source
var = []

for i in range(1000):

This makes a list of class instances. Is that what you want?

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download