diff options
Diffstat (limited to 'python.html.markdown')
| -rw-r--r-- | python.html.markdown | 23 | 
1 files changed, 15 insertions, 8 deletions
diff --git a/python.html.markdown b/python.html.markdown index e7ee6fbd..f0b74d08 100644 --- a/python.html.markdown +++ b/python.html.markdown @@ -6,7 +6,7 @@ filename: learnpython.py  ---  Python was created by Guido Van Rossum in the early 90's. It is now one of the most popular -languages in existence. I fell in love with Python for its syntactic clarity. Its basically +languages in existence. I fell in love with Python for its syntactic clarity. It's basically  executable pseudocode.  Feedback would be highly appreciated! You can reach me at [@louiedinh](http://twitter.com/louiedinh) or louiedinh [at] [google's email service] @@ -67,7 +67,7 @@ not False #=> True  2 <= 2 #=> True  2 >= 2 #=> True -# Comparisons can be chained  ! +# Comparisons can be chained!  1 < 2 < 3 #=> True  2 < 3 < 2 #=> False @@ -214,7 +214,7 @@ filled_dict.values() #=> [3, 2, 1]  "one" in filled_dict #=> True  1 in filled_dict #=> False - # Looking up a non-existing key is a KeyError +# Looking up a non-existing key is a KeyError  filled_dict["four"] # KeyError  # Use get method to avoid the KeyError @@ -232,7 +232,7 @@ filled_dict.setdefault("five", 6) #filled_dict["five"] is still 5  # Sets store ... well sets  empty_set = set()  # Initialize a set with a bunch of values -some_set = set([1,2,2,3,4]) # filled_set is now set([1, 2, 3, 4]) +some_set = set([1,2,2,3,4]) # some_set is now set([1, 2, 3, 4])  # Since Python 2.7, {} can be used to declare a set  filled_set = {1, 2, 2, 3, 4} # => {1 2 3 4} @@ -263,7 +263,7 @@ filled_set | other_set #=> {1, 2, 3, 4, 5, 6}  some_var = 5  # Here is an if statement. Indentation is significant in python! -# prints "some var is smaller than 10" +# prints "some_var is smaller than 10"  if some_var > 10:      print "some_var is totally bigger than 10."  elif some_var < 10:    # This elif clause is optional. @@ -394,7 +394,7 @@ filter(lambda x: x > 5, [3, 4, 5, 6, 7]) #=> [6, 7]  # We subclass from object to get a class.  class Human(object): -     # A class attribute. It is shared by all instances of this class +    # A class attribute. It is shared by all instances of this class      species = "H. sapiens"      # Basic initializer @@ -470,12 +470,19 @@ dir(math)  ``` -## Further Reading +## Ready For More? -Still up for more? Try: +### Free Online  * [Learn Python The Hard Way](http://learnpythonthehardway.org/book/)  * [Dive Into Python](http://www.diveintopython.net/)  * [The Official Docs](http://docs.python.org/2.6/)  * [Hitchhiker's Guide to Python](http://docs.python-guide.org/en/latest/)  * [Python Module of the Week](http://pymotw.com/2/) + +### Dead Tree + +* [Programming Python](http://www.amazon.com/gp/product/0596158106/ref=as_li_qf_sp_asin_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=0596158106&linkCode=as2&tag=homebits04-20) +* [Dive Into Python](http://www.amazon.com/gp/product/1441413022/ref=as_li_tf_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=1441413022&linkCode=as2&tag=homebits04-20) +* [Python Essential Reference](http://www.amazon.com/gp/product/0672329786/ref=as_li_tf_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=0672329786&linkCode=as2&tag=homebits04-20) +  | 
