Citizen,
On 28 May 2013 14:45, Citizen Kant <citizenk...@gmail.com> wrote: > I'm trying to figure out the rules on how to recognize when a combination > of symbols is considered a well formed expression in Python. > How do you recognize that an arithmetic expression is a well formed (e.g. valid) expression? How do you recognize that an English is valid grammatically? > Since I couldn't find any doc that lists all Python syntax rules --or > maybe the doc is too long to be managed by me right now--, > Perhaps you need to look at the Python grammar specification. One of the reasons Python is actually relatively easy to learn is that it's grammar is actually not that big, which means it's actually not that hard to learn, as you say, to recognize when Python expressions or statements are valid or invalid: http://docs.python.org/2.7/reference/grammar.html Of course, the Python grammar covers the entire language, not just expressions. stating all kinds of legal combination among its symbols, I had this idea > that well formed expressions must respond to truth tables. I think I'm not > pretty much interested on how each symbol like 9 or Z or + come to be truth > (maybe I'm wrong) but in the truth of their combinations. > Do you know boolean algebra? The combination of boolean values result in futher boolean values in relatively intuitive ways, which yes, can be enumerated explicitly using a truth table. > Do I am in the correct path? Understanding the truth tables (which I'm not > very familiarized with) would help me on writing Python in a more intuitive > way? > I'm not sure truth tables by themselves will help with your intuition, though they might if you reason about boolean expressions and then enumerate all the possible combinations and produce a truth table to summarise the your reasoning. For example, suppose you have the boolean expression "A or B". What values of A and B will cause the expression to be True? And what would cause it to be False? Now consider the expression "A and B", and then the expression "A or B and C". Etc. Walter
_______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor