in reply to Weird syntax question
"or print 0" is true unless the print fails so your if ends up being true as well which causes the "print 1" to be executed.