Re: [Tutor] list of instance objects, access attribute

2009-06-19 Thread Vincent Davis
Thanks to all for the comments, It was much more than I expected. Vincent On Fri, Jun 19, 2009 at 4:30 PM, Lie Ryan wrote: > Alan Gauld wrote: >> >> "Vincent Davis" wrote >> >> class B(): >>  def __init__(self, b1, b2): >>     self.fooa = b1 >>     self.foob = b2 >> >> I assume thats what you r

Re: [Tutor] list of instance objects, access attribute

2009-06-19 Thread Lie Ryan
Alan Gauld wrote: > > "Vincent Davis" wrote > > class B(): > def __init__(self, b1, b2): > self.fooa = b1 > self.foob = b2 > > I assume thats what you really meant! > > Ok now I have several instances in a list > b1 = B(1, 2) > b2 = B(3, 4) > b3 = B(9, 10) > alist = [b1, b2, b3] > >>

Re: [Tutor] list of instance objects, access attribute

2009-06-19 Thread Alan Gauld
"Vincent Davis" wrote class B(): def __init__(self, b1, b2): self.fooa = b1 self.foob = b2 I assume thats what you really meant! Ok now I have several instances in a list b1 = B(1, 2) b2 = B(3, 4) b3 = B(9, 10) alist = [b1, b2, b3] Lets say for each instance of the class I want to

Re: [Tutor] list of instance objects, access attribute

2009-06-18 Thread Dave Angel
Vincent Davis wrote: given a class like class B(): def __init__(self, b1, b2): ??? self.fooa = fooa ??? self.foob = foob Ok now I have several instances in a list b1 = B(1, 2) b2 = B(3, 4) b3 = B(9, 10) alist = [b1, b2, b3] Lets say for each instance of the class I want to print the value of fo

Re: [Tutor] list of instance objects, access attribute

2009-06-18 Thread Kent Johnson
On Thu, Jun 18, 2009 at 7:32 PM, Vincent Davis wrote: > given a class like > class B(): > def __init__(self, b1, b2): >     self.fooa = fooa >     self.foob = foob > > Ok now I have several instances in a list > b1 = B(1, 2) > b2 = B(3, 4) > b3 = B(9, 10) > alist = [b1, b2, b3] > > Lets say for eac