[Q] Question from Python tutorial
ylee12 at uiuc.edu
Thu Mar 1 20:38:02 CET 2001
I typed them manually. I dind't copy and paste.
"Jay O'Connor" <joconnor at cybermesa.com> wrote in message
news:3A9EA472.F15AF847 at cybermesa.com...
> Young-Jin Lee wrote:
> > Hi, I have a question from Python tutorial.
> > The code segment in the page 60 (chapter 9. classes) is not executed.
> > I don't know what I did wrong. Here is the code and the error I got.
> > class MyClass:
> > "A simple example class"
> > i = 12345
> > def f( x ):
> > return 'hello world'
> > x = MyClass()
> > x.counter = 1
> > while x.counter < 10:
> > x.counter = x.counter * 2
> > print x.counter
> > ^
> > SyntaxError: invalid syntax
> > There is no typo, I have no idea of where this SyntaxError came from.
> > Thanks in advance. Any comment would be greatly appreciated.
> You probably cut and pasted the code from the tutorial. When I cut and
> pasted your code into IDLE, I got the same error. When I manyually typed
> the code, it works fine. My guess is that the cut and paste didn't paste
> properly and the interactive interpreter didn't make the right break
> between the 2 and the word print
> Jay O'Connor
> joconnor at cybermesa.com
> Python Language Forum -
More information about the Python-list