Re: A question about searching with multiple strings

2005-10-22 Thread Steven D'Aprano
On Fri, 21 Oct 2005 13:39:17 -0700, googleboy wrote: > Hi there. > > I have defined a class called Item with several (about 30 I think) > different attributes (is that the right word in this context?). Generally speaking, attributes shouldn't be used for storing arbitrary items in an object. Tha

Re: A question about searching with multiple strings

2005-10-22 Thread Steven D'Aprano
On Fri, 21 Oct 2005 13:39:17 -0700, googleboy wrote: > > Hi there. > > I have defined a class called Item with several (about 30 I think) > different attributes (is that the right word in this context?). An > abbreviated example of the code for this is: > > class Item(object): > > def _

Re: A question about searching with multiple strings

2005-10-21 Thread Mike Meyer
"googleboy" <[EMAIL PROTECTED]> writes: > for item in all_items: > > strItem = str(item) > > m = re.search(p[i], strItem, flags = re.I) > if m: > height = getattr(item, "height") > length = getattr(item, "length") > function = getattr(item

A question about searching with multiple strings

2005-10-21 Thread googleboy
Hi there. I have defined a class called Item with several (about 30 I think) different attributes (is that the right word in this context?). An abbreviated example of the code for this is: class Item(object): def __init__(self, height, length, function): params = locals