I'm try to run a quadtree example (first bit of code on that page) from pygame but am getting a syntax error on a very confusing line:
in_nw = item.left <= cx and item.top <= cy
The syntax error points at the second equals sign in the expression (<=
). I know semicolons can be used to put multiple expressions on one line, but wouldn't that mean that this would be the same as:
in_nw = item.left <
= cx and item.top <
= cy
The problem is, this doesn't make any sense with the leading equals sign. There must be something else going on there. I've spent a couple hours trying to figure this out and reading about compound statements.
Does anyone know what this is suppose to do or a different way of writing it? I assume it worked for the author and the guy who posted a similar code below him with the same syntax, but for some reason it isn't working for me. I really just want to rewrite this part without having to decrypt the rest of his code to figure out what he was trying to do.