From 13807790e46d4b75b90d6da17e6c28f4ed9e5a49 Mon Sep 17 00:00:00 2001 From: DaKnOb Date: Fri, 2 Oct 2015 16:42:57 +0300 Subject: Add note about Python Module Order of Import --- python.html.markdown | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'python.html.markdown') diff --git a/python.html.markdown b/python.html.markdown index 352f7349..e306dabd 100644 --- a/python.html.markdown +++ b/python.html.markdown @@ -569,6 +569,12 @@ math.sqrt == m.sqrt == sqrt # => True import math dir(math) +# If you have a Python script named math.py in the same +# folder as your current script, the file math.py will +# be loaded instead of the built-in Python module. +# This happens because the local folder has priority +# over Python's built-in libraries. + #################################################### ## 7. Advanced -- cgit v1.2.3 From e60a7d73e846e683bd4345cff4d1a514beab5b91 Mon Sep 17 00:00:00 2001 From: jxu093 Date: Sun, 25 Oct 2015 22:19:40 -0400 Subject: Added Python Resource --- python.html.markdown | 1 + 1 file changed, 1 insertion(+) (limited to 'python.html.markdown') diff --git a/python.html.markdown b/python.html.markdown index 42a52bcf..254235ab 100644 --- a/python.html.markdown +++ b/python.html.markdown @@ -712,6 +712,7 @@ print say(say_please=True) # Can you buy me a beer? Please! I am poor :( * [Python Module of the Week](http://pymotw.com/2/) * [A Crash Course in Python for Scientists](http://nbviewer.ipython.org/5920182) * [First Steps With Python](https://realpython.com/learn/python-first-steps/) +* [Fullstack Python](https://www.fullstackpython.com/) ### Dead Tree -- cgit v1.2.3 From 0049a475edba88f6537b2490ca9506df23b46368 Mon Sep 17 00:00:00 2001 From: Aayush Ranaut Date: Sat, 31 Oct 2015 22:20:51 +0530 Subject: Removed confusing comments --- python.html.markdown | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'python.html.markdown') diff --git a/python.html.markdown b/python.html.markdown index 5572e38e..abc461a2 100644 --- a/python.html.markdown +++ b/python.html.markdown @@ -404,7 +404,7 @@ add(y=6, x=5) # Keyword arguments can arrive in any order. # You can define functions that take a variable number of -# positional args, which will be interpreted as a tuple if you do not use the * +# positional args, which will be interpreted as a tuple def varargs(*args): return args @@ -412,7 +412,7 @@ varargs(1, 2, 3) # => (1, 2, 3) # You can define functions that take a variable number of -# keyword args, as well, which will be interpreted as a dict if you do not use ** +# keyword args, as well, which will be interpreted as a dict def keyword_args(**kwargs): return kwargs -- cgit v1.2.3 From 299d064ecf7598144e49ef336e0abd00ccc4ae16 Mon Sep 17 00:00:00 2001 From: sarthfrey Date: Wed, 16 Dec 2015 16:41:07 -0500 Subject: Added Python Resources --- python.html.markdown | 1 + 1 file changed, 1 insertion(+) (limited to 'python.html.markdown') diff --git a/python.html.markdown b/python.html.markdown index d8f18e9b..1d6c0a19 100644 --- a/python.html.markdown +++ b/python.html.markdown @@ -726,6 +726,7 @@ print say(say_please=True) # Can you buy me a beer? Please! I am poor :( * [Python Module of the Week](http://pymotw.com/2/) * [A Crash Course in Python for Scientists](http://nbviewer.ipython.org/5920182) * [First Steps With Python](https://realpython.com/learn/python-first-steps/) +* [LearnPython](http://www.learnpython.org/) ### Dead Tree -- cgit v1.2.3 From 39c83718b14a768ed62a6644ed633c9a032ff9f6 Mon Sep 17 00:00:00 2001 From: sarthfrey Date: Mon, 25 Jan 2016 18:34:25 -0500 Subject: removed merge stuff --- python.html.markdown | 3 --- 1 file changed, 3 deletions(-) (limited to 'python.html.markdown') diff --git a/python.html.markdown b/python.html.markdown index 70f7f73f..2e7fd8be 100644 --- a/python.html.markdown +++ b/python.html.markdown @@ -726,11 +726,8 @@ print say(say_please=True) # Can you buy me a beer? Please! I am poor :( * [Python Module of the Week](http://pymotw.com/2/) * [A Crash Course in Python for Scientists](http://nbviewer.ipython.org/5920182) * [First Steps With Python](https://realpython.com/learn/python-first-steps/) -<<<<<<< HEAD * [LearnPython](http://www.learnpython.org/) -======= * [Fullstack Python](https://www.fullstackpython.com/) ->>>>>>> adambard/master ### Dead Tree -- cgit v1.2.3 From 5f89f277b9b2ee778ccc2e2f044b3f7dbbb6c5ea Mon Sep 17 00:00:00 2001 From: Divay Prakash Date: Fri, 18 Mar 2016 12:23:18 +0530 Subject: fixed whitespaces & content extending beyond 80 chars --- python.html.markdown | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) (limited to 'python.html.markdown') diff --git a/python.html.markdown b/python.html.markdown index 12be4be1..28b0a7ae 100644 --- a/python.html.markdown +++ b/python.html.markdown @@ -8,20 +8,22 @@ contributors: filename: learnpython.py --- -Python was created by Guido Van Rossum in the early 90s. It is now one of the most popular -languages in existence. I fell in love with Python for its syntactic clarity. It's basically -executable pseudocode. +Python was created by Guido Van Rossum in the early 90s. It is now one of the +most popular 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] +Feedback would be highly appreciated! You can reach me at [@louiedinh](http://twitter.com/louiedinh) +or louiedinh [at] [google's email service] -Note: This article applies to Python 2.7 specifically, but should be applicable -to Python 2.x. Python 2.7 is reaching end of life and will stop being maintained in 2020, -it is though recommended to start learning Python with Python 3. -For Python 3.x, take a look at the [Python 3 tutorial](http://learnxinyminutes.com/docs/python3/). +Note: This article applies to Python 2.7 specifically, but should be applicable +to Python 2.x. Python 2.7 is reaching end of life and will stop being +maintained in 2020, it is though recommended to start learning Python with +Python 3. For Python 3.x, take a look at the [Python 3 tutorial](http://learnxinyminutes.com/docs/python3/). -It is also possible to write Python code which is compatible with Python 2.7 and 3.x at the same time, -using Python [`__future__` imports](https://docs.python.org/2/library/__future__.html). `__future__` imports -allow you to write Python 3 code that will run on Python 2, so check out the Python 3 tutorial. +It is also possible to write Python code which is compatible with Python 2.7 +and 3.x at the same time, using Python [`__future__` imports](https://docs.python.org/2/library/__future__.html). `__future__` imports +allow you to write Python 3 code that will run on Python 2, so check out the +Python 3 tutorial. ```python @@ -32,6 +34,7 @@ allow you to write Python 3 code that will run on Python 2, so check out the Pyt as comments """ + #################################################### ## 1. Primitive Datatypes and Operators #################################################### @@ -188,6 +191,7 @@ some_other_var # Raises a name error # Equivalent of C's '?:' ternary operator "yahoo!" if 3 > 2 else 2 # => "yahoo!" + # Lists store sequences li = [] # You can start with a prefilled list @@ -441,6 +445,7 @@ with open("myfile.txt") as f: for line in f: print line + #################################################### ## 4. Functions #################################################### @@ -464,7 +469,6 @@ def varargs(*args): varargs(1, 2, 3) # => (1, 2, 3) - # You can define functions that take a variable number of # keyword args, as well, which will be interpreted as a dict by using ** def keyword_args(**kwargs): @@ -698,7 +702,6 @@ for i in double_numbers(xrange_): # message from functools import wraps - def beg(target_function): @wraps(target_function) def wrapper(*args, **kwargs): @@ -709,13 +712,11 @@ def beg(target_function): return wrapper - @beg def say(say_please=False): msg = "Can you buy me a beer?" return msg, say_please - print say() # Can you buy me a beer? print say(say_please=True) # Can you buy me a beer? Please! I am poor :( ``` -- cgit v1.2.3