Newbie: need help with control loop

Shaggy nospam.python at scoobysnacks.com
Mon Dec 13 06:12:14 EST 1999


On 13 Dec 1999 05:49:18 GMT, tjreedy at udel.edu (Terry Reedy) wrote:

>In article <38543b80.289200819 at news-server>, 
>nospam.python at scoobysnacks.com says...
>>
>>I'm trying to write a simple program to change passwords on a large
>>number of routers but I'm having trouble with the control loop.  This
>>may be very poor code but I've only been at this for a week.  I want
>>to do more than one router at a time so I don't have to wait for each
>>one to finish before I start the next.  I also don't want to start ALL
>>of them at the same time.  The problem I'm having is being able to
>>create an object instance based on a list value.  The list is
>>arbitrary and may change often.  Here is where I'm at.
>>
>>if __name__ == '__main__':
>>        list=['host1','host2','host3','host4','host5',
>>                'host6','host7','host8','host9','host0']
>'list' is the name of a built in function, and therefor a bad choice of 
>local variable name.  Use 'hosts' instead
>
>>        running=[]
>>        for machine in range(len(list)):
>You do not appear to need index.  If not, better is
>  for machine in hosts:
>
>You should probable create instance next:
>  host_inst = class_name(machine)

This was my whole question.  Where or what is host_inst.  In each case
it will be different I can create the object, I just can't name it.

P.S.
Thanks for all the other pointers, and that is a real email address.
I usually use marshall@ but eitherway it will be delivered.  It's just
easier to filter all addresses on nospam if there were a problem.





More information about the Python-list mailing list