On 20/02/06, Kermit Rose <[EMAIL PROTECTED]> wrote: > >>> 8*a%2 > 0 > The * is being given equal priority to %. > > Why isn't % given higher priority than *?
Calling it a bug is a bit harsh when it's documented that way :-) See: http://docs.python.org/ref/summary.html *, / and % all have the same precedence. I guess the reasoning is that / is (approximately) the inverse of * and % is "remainder after /". > Also, why am I getting a syntax error in the following? When you're using the interactive interpreter, you need to end a function definition with an extra carriage return. (at least, that's the way it works in the console version) eg: >>> def foo(): ... pass ... def bar(): File "<stdin>", line 3 def bar(): ^ SyntaxError: invalid syntax vs: >>> def foo(): ... pass ... >>> def bar(): ... pass ... >>> HTH! -- John. _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor