Brendan Barnwell wrote:
> johnf wrote:
>> On Wednesday 12 September 2007 19:07, [EMAIL PROTECTED] wrote:
>>> Nate,
>>> That's exactly what I came up with.  We were just wondering if that was the
>>> only way to do it.
>>>
>>> What's cool about this is I can refer to the object by doing the
>>> following...
>>>
>>> for i in range(1, 10):
>>>    exec("o=self.biz%s = dabo.biz.dBizObj()" % i)
>>>    o.CurrentSql=....
>>>    o.do_something_else
>>>
>>> Thanks
>>> Larry Long
>>>
>>> p.s  If I executed the code above, does
>>> o=None
>>> Release the bizobj? I don't think it does.  if not, then how can I release
>>> it?
>>>
>> Don't you like Brendan Barnwell solution better - using setattr()?  
>> John
> 
>       Actually, I think an even better solution would be to not set the 
> attributes at 
> all, but use a dictionary (or, in this case, even just a list).  Instead of 
> doing
> 
> for i in range(1, 10):
>       setattr(self, "biz%s" % i", dabo.biz.dBizObj)
>       o.CurrentSql=....
>       o.do_something_else
> 
> . . . do it this way:
> 
> self.bizObjs = {}
> for i in range(1,10):
>       self.bizObjs[i] = dabo.biz.dbizObj()
> 
> Then access them with self.bizObjs[i] instead of self.bizObj1, self.bizObj2, 
> etc.
> 

Attention.
I you do this, don't expect that Dabo works as it should any more.

Uwe





_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users
Searchable Archives: http://leafe.com/archives/search/dabo-users
This message: http://leafe.com/archives/byMID/dabo-users/[EMAIL PROTECTED]

Reply via email to