B
Bruce McGoveran
Hello. I am new to this group. I've done a search for the topic about which I'm posting, and while I have found some threads that are relevant, I haven't found anything exactly on point that I can understand. So, I'm taking the liberty of asking about something that may be obvious to many readersof this group.
The relevant Python documentation reference is: http://docs.python.org/2/reference/expressions.html#boolean-operations.
I'm trying to make sense of the rules of or_test, and_test, and not_test that appear in this section. While I understand the substance of the text inthis section, it is the grammar definitions themselves that confuse me. For example, I am not clear how an or_test can be an and_test. Moreover, ifI follow the chain of non-terminal references, I move from or_test, to and_test, to not_test, to comparison. And when I look at the definition for comparison, I seem to be into bitwise comparisons. I cannot explain this.
Perhaps an example will help put my confusion into more concrete terms. Suppose I write the expression if x or y in my code. I presume this is an example of an or_test. Beyond that, though, I'm not sure whether this maps to an and_test (the first option on the right-hand side of the rule) or to the or_test "or" and_test option (the second on the right-hand side of the rule).
If people can offer some thoughts to put me in the right direction (or out of my misery), I would appreciate it.
Thank you in advance.
The relevant Python documentation reference is: http://docs.python.org/2/reference/expressions.html#boolean-operations.
I'm trying to make sense of the rules of or_test, and_test, and not_test that appear in this section. While I understand the substance of the text inthis section, it is the grammar definitions themselves that confuse me. For example, I am not clear how an or_test can be an and_test. Moreover, ifI follow the chain of non-terminal references, I move from or_test, to and_test, to not_test, to comparison. And when I look at the definition for comparison, I seem to be into bitwise comparisons. I cannot explain this.
Perhaps an example will help put my confusion into more concrete terms. Suppose I write the expression if x or y in my code. I presume this is an example of an or_test. Beyond that, though, I'm not sure whether this maps to an and_test (the first option on the right-hand side of the rule) or to the or_test "or" and_test option (the second on the right-hand side of the rule).
If people can offer some thoughts to put me in the right direction (or out of my misery), I would appreciate it.
Thank you in advance.