# aima-python Python 3 code for the book *Artificial Intelligence: A Modern Approach.* Eventually, this repository should have code for everything in the book. # Style Guide We default to [Pep 8](https://www.python.org/dev/peps/pep-0008), but with a few exceptions: - I'm not too worried about an occasional line longer than 79 characters. - You don't need two spaces after a sentence-ending period. - Strunk and White is [not a good guide for English](http://chronicle.com/article/50-Years-of-Stupid-Grammar/25497). - I prefer more concise docstrings; I don't follow [Pep 257](https://www.python.org/dev/peps/pep-0257/). - Not all constants have to be UPPERCASE. - [Pep 484](https://www.python.org/dev/peps/pep-0484/) type annotations are allowed but not required. If your parameter name is already suggestive of the name of a type, you don't need an annotation, e.g.: def retry(url: Url) -> None: # This 'Url' annotation should be avoided; but '-> None' is useful # Language Popularity Are we right to concentrate on Java and Python versions of the code? What languages do students already know? The [TIOBE Index](http://www.tiobe.com/tiobe_index) says the top five are: Java, C, C++, C#, Python What languages are instructors recommending for their AI class? To get an approximate idea, I gave the query norvig russell "Modern Approach" along with the names of various languages and looked at the estimated counts of results on various dates. However, I don't have much confidence in these figures...
Language | 2004 | 2005 | 2007 | 2010 | 2016 |
---|---|---|---|---|---|
none | 8,080 | 20,100 | 75,200 | 150,000 | 132,000 |
java | 1,990 | 4,930 | 44,200 | 37,000 | 50,000 |
c++ | 875 | 1,820 | 35,300 | 105,000 | 35,000 |
lisp | 844 | 974 | 30,100 | 19,000 | 14,000 |
prolog | 789 | 2,010 | 23,200 | 17,000 | 16,000 |
python | 785 | 1,240 | 18,400 | 11,000 | 12,000 |