The recent sudden interest in identification code recognition, and then studied some image recognition and processing of data, which has an image processing is about the font refinement and skeleton extraction, but this algorithm does not have a ready-made Java code implementation, those claims Java version of the code is mostly poor or not at all. Search on the way to see a python implementation of the refinement of the skeleton algorithm, the effect is very good, think of this Python implementation to rewrite into Java good. But, in fact, I do not understand python, so first to read the Python syntax, and then began to rewrite ... The problem arises ... I hesitated when I encountered the logical operator and in the source program. Let's take a look at the explanation of and in the list:
Boolean "and"-if x is False,x and Y returns false, otherwise it returns the computed value of Y.
After seeing this streamlined explanation, I was shocked. What the hell is it saying? What is the relationship between this and logic? The logic and definitions in Python are so wonderful. Forget it, just use if else to translate this passage into the past, even if it is. But then the source program appeared xx and XX and XX statements, which will be used if else to translate that simply ... I suddenly want a normal brain. How can you expect the meaning of this expression if you follow this logic ... python logic and should not be wonderful, the wonderful should be this explanation is ... Re-thought of the mind.
The definition of Logic and (&&) in Java is very clear and is explained as follows:
And:
A & B: A&b is true when a B is true, otherwise false
Logic with:
A && B, when a is false, then a && B returns false, and B is not judged again, because when a is false, regardless of the value of B, the expression a && B will be false according to the definition. However, if a is true, you need to further evaluate the value of B, and the final value of the expression a && B differs depending on the value of B.
After a comparison of the explanation of the story, it turns out that they are talking about a thing. But the word of the story is somewhat misleading, and it excessively emphasizes that the value of an expression is x or Y, and fades the meaning of the expression. There is an illusion that the logical and the value is not the same as, but in some cases a or B value.
logical operators and small analysis of Python