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,
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:
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):
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 =
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
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