[Tutor] Bug in python

Hugo González Monteverde hugonz-lists at h-lab.net
Wed Feb 22 03:48:10 CET 2006


Hi, just a recommendation: try not to assume a bug beforehand, that's a 
quick way to get flames or just get plain ignored, especially in a list 
for beginners.

> The * is being given equal  priority to %.
> 
> Why isn't % given higher priority than *?

Why should it? Doesn't it make sense that as '/'
  and * have the same precedence, '%' should have the same?

Check the precedence for python operators here:
http://www.byteofpython.info/read/operator-precedence.html
http://docs.python.org/ref/summary.html

Check the precedence for C operators here:
http://publications.gbdirect.co.uk/c_book/chapter2/expressions_and_arithmetic.html

So everything alright, also, left to right, as expected.


> Also,  why am I getting a syntax error  in the following?
> 

To get more informative messages, save all those statements to a file, 
and then try and run the file. It is extremely easy to mess up 
indentantion and make mistakes in the interactive prompt. Aslo you'll be 
getting information about the line number and such.

Hugo


More information about the Tutor mailing list