473,396 Members | 1,891 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Instantiating for loop

4
Is there a way to do this with some kind of a loop? thanks!

Expand|Select|Wrap|Line Numbers
  1.     if refrence == "Loshlf_16": b=Loshlf_16.execute()
  2.     elif refrence == "Loshlf_20": b=Loshlf_20.execute()
  3.     elif refrence == "Loshlf_25": b=Loshlf_25.execute()
  4.     elif refrence == "Loshlf_32": b=Loshlf_32.execute()
  5.     elif refrence == "Loshlf_40": b=Loshlf_40.execute()
  6.     elif refrence == "Loshlf_50": b=Loshlf_50.execute()
  7.     elif refrence == "Loshlf_63": b=Loshlf_63.execute()
  8.     elif refrence == "Loshlf_80": b=Loshlf_80.execute()
  9.     elif refrence == "Loshlf_100": b=Loshlf_100.execute()
  10.     elif refrence == "Loshlf_125": b=Loshlf_125.execute()
  11.     elif refrence == "Loshlf_160": b=Loshlf_160.execute()
  12.     elif refrence == "Loshlf_200": b=Loshlf_200.execute()
  13.     elif refrence == "Loshlf_250": b=Loshlf_250.execute()
  14.     elif refrence == "Loshlf_315": b=Loshlf_315.execute() 
  15.     elif refrence == "Loshlf_400": b=Loshlf_400.execute()
  16.     elif refrence == "Loshlf_500": b=Loshlf_500.execute()
  17.     elif refrence == "Loshlf_630": b=Loshlf_630.execute()
  18.     elif refrence == "Loshlf_800": b=Loshlf_800.execute()
  19.     elif refrence == "Loshlf_1000": b=Loshlf_1250.execute()
  20.     elif refrence == "Loshlf_1600": b=Loshlf_1600.execute()
  21.     elif refrence == "Loshlf_2000": b=Loshlf_2000.execute()
  22.     elif refrence == "Loshlf_2500": b=Loshlf_2500.execute()
  23.     elif refrence == "Loshlf_3150": b=Loshlf_3150.execute()
  24.     elif refrence == "Loshlf_4000": b=Loshlf_4000.execute()
  25.     elif refrence == "Loshlf_5000": b=Loshlf_5000.execute()
  26.     elif refrence == "Loshlf_6300": b=Loshlf_6300.execute()
  27.     elif refrence == "Loshlf_8000": b=Loshlf_8000.execute()
  28.     elif refrence == "Loshlf_10000": b=Loshlf_8000.execute()
  29.     elif refrence == "Loshlf_12500": b=Loshlf_12500.execute()
  30.     elif refrence == "Loshlf_16000": b=Loshlf_16000.execute()
  31.     elif refrence == "Loshlf_20000": b=Loshlf_20000.execute()
  32.  
Aug 11 '08 #1
2 1137
boxfish
469 Expert 256MB
I think so, but not a loop. You could do this with the exec keyword:
Expand|Select|Wrap|Line Numbers
  1. exec "b=" + refrence + ".execute()"
Hope this helps.
Aug 11 '08 #2
bvdet
2,851 Expert Mod 2GB
You can also use eval:
Expand|Select|Wrap|Line Numbers
  1. b = eval("%s.execute()" % refrence)
Aug 12 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: david | last post by:
Well, as a matter of fact I_HAD_MISSED a basic thing or two, anyway, although Ollie's answer makes perfectly sense when dealing with classes, it doesn't seem to me to apply as well if you have to...
0
by: Esteban404 | last post by:
I defined a form object with databinding: frmDisplay. When the dataset of that form has displayed its content 5 times, I need to instantiate a new copy of the form and display that content. Here is...
2
by: HarishP | last post by:
Hi, How to avoid instantiating the class more than 10 times Harish.P Sr. Software Engineer Comat Technologies Pvt. Ltd., Bangalore Email: harish.p@comat.com
4
by: Tom | last post by:
I have a VB.NET framework 1.1 application that I am installing on my user's workstation. It works fine on EVERY machine except for one - on this one machine it generates a 'Overflow or underflow in...
6
by: Gary Frank | last post by:
What are the ramifications if I were to instantiate an object tens of thousands of times and add them to an array? Or hundreds of thousands of times? Do you know if the act of instantiating a...
1
by: Marja Ribbers-de Vroed | last post by:
I've been provided with a custom ActiveX DLL (written in C++) that reads a certiifcate to generate a signature for a passed XML string, and I'm having trouble instantiating it. The DLL is registered...
3
by: Nagesh | last post by:
hi, I have seen the winvnc(tightvnc server) source code in this I seen that class member funtions are calling without instantiating the object i.e. like vncService::ShowDefaultProperties() where...
3
by: raylopez99 | last post by:
Below is my problem. I've narrowed it down to one thing: my unfamiliarity on how class instances are instantiated in an array. This is because the "un-array" / "non-array" version of the program...
3
by: Glupii | last post by:
I am trying to Instantiate (did I spell that right?) and dimension an array of objects but I keep getting a NullReferenceException not handled error telling me to use the "new" keyword to create an...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.