The grokking eagle

Hoc age

Posts Tagged ‘Language’

Politics and the English Language by George Orwell

Posted by arnulfo on 2009/07/25

Posted in Uncategorized | Tagged: , , , , | Leave a Comment »

and or python

Posted by arnulfo on 2007/07/26

4.6. The Peculiar Nature of and and or

 

In Python, and and or perform boolean logic as you would expect, but they do not return boolean values; instead, they return one of the actual values they are comparing.

This trick may seem like more trouble than it’s worth. You could, after all, accomplish the same thing with an if statement, so why go through all this fuss? Well, in many cases, you are choosing between two constant values, so you can use the simpler syntax and not worry, because you know that the a value will always be true. And even if you need to use the more complicated safe form, there are good reasons to do so. For example, there are some cases in Python where if statements are not allowed, such as in lambda functions.

 

Further Reading on the and-or Trick

Posted in Uncategorized | Tagged: , , , | Leave a Comment »

SWI-Prolog

Posted by arnulfo on 2007/07/14

SWI-Prolog offers a comprehensive Free Software Prolog environment, licensed under the Lesser GNU Public License. Together with its graphics toolkit XPCE, its development started in 1987 and has been driven by the needs for real-world applications.

Read the rest of this entry »

Posted in Uncategorized | Tagged: , | 1 Comment »