error in tutorial for 3.0, section 9.3.3

2009-05-23 Thread Vincent Davis
Section 9.3.3 says that given, class MyClass: A simple example class i = 12345 def f(self): return 'hello world' and x = MyClass() then this x.counter = 1 while x.counter 10: x.counter = x.counter * 2 print(x.counter) del x.counter will print 16 link,

Re: error in tutorial for 3.0, section 9.3.3

2009-05-23 Thread Vincent Davis
let me add that I see that this could be right if x.counter = 1 and counter need not have anything to do with MyClass but this could be more clear. Thanks Vincent Davis 720-301-3003 On Sat, May 23, 2009 at 7:08 AM, Vincent Davis vinc...@vincentdavis.netwrote: Section 9.3.3 says that given,

Re: error in tutorial for 3.0, section 9.3.3

2009-05-23 Thread Vincent Davis
Thank you that makes sense to me. Much more clear then the tutorial, I think so anyway. If you are learning about classes that you kinda expect MyClass to have counter in it. I might be nice to show that x.counter = 1 creates an instance that would look like (is this correct?) class MyClass:

Re: error in tutorial for 3.0, section 9.3.3

2009-05-23 Thread Michiel Overtoom
Vincent writes: you kinda expect MyClass to have counter in it. Yeah, that makes sense. These instance variables are often initialized in the __init__ method: class Counter(object): def __init__(self,initialvalue): self.value=initialvalue def inc(self):

Re: error in tutorial for 3.0, section 9.3.3

2009-05-23 Thread Benjamin Kaplan
On Sat, May 23, 2009 at 10:46 AM, Vincent Davis vinc...@vincentdavis.netwrote: Thank you that makes sense to me. Much more clear then the tutorial, I think so anyway. If you are learning about classes that you kinda expect MyClass to have counter in it. I might be nice to show that x.counter =

Re: error in tutorial for 3.0, section 9.3.3

2009-05-23 Thread Dave Angel
Vincent Davis wrote: Section 9.3.3 says that given, class MyClass: A simple example class i = 12345 def f(self): return 'hello world' and x = MyClass() then this x.counter = 1 while x.counter 10: x.counter = x.counter * 2 print(x.counter) del x.counter will print 16

Re: Re: error in tutorial for 3.0, section 9.3.3

2009-05-23 Thread Dave Angel
Vincent Davis wrote: Thank you that makes sense to me. Much more clear then the tutorial, I think so anyway. If you are learning about classes that you kinda expect MyClass to have counter in it. I might be nice to show that x.counter = 1 creates an instance that would look like (is this