error in tutorial for 3.0, section 9.3.3

Vincent Davis vincent at vincentdavis.net
Sat May 23 09:13:29 EDT 2009


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 <vincent at vincentdavis.net>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
>
> link,
> http://docs.python.org/3.0/tutorial/classes.html#a-first-look-at-classes
>
> I am reading this section so to learn about classes but if this is right I
> think I need to start over.
>
>
> Thanks
> Vincent Davis
> 720-301-3003
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20090523/0f270160/attachment-0001.html>


More information about the Python-list mailing list