September 2018
This post was inspired by Hadley Wickham's notion that "Context-switching is expensive." I have found that statement painfully true from my own experiences as well. To quote from his book, R for Data Science,
You will get better faster if you dive deep, rather than spreading yourself thinly over many topics.Programming Foundations: Fundamentals, chooses to use JavaScript in its examples. I understand how it would be difficult for a beginner to context switch from JavaScript to Python (once the semester starts). I figured since I am learning Python as well, why not document what I've learned as I go? So here goes. Please note that I am loosely following the videos and this is a learning experience for me as well.
To start, I know that not everyone here is going to be in ISTM 615 or an Analytics major. So here are some free, highly recommended Python resources if you just want to learn Python:
- Python's documentation - an up to date and freely available resource. The secret to success in any technology field? Read the manual! The documentation is almost always the most current and accurate source of information.
- Al Sweigart's Creative Commons books, most notably Automate the Boring Stuff with Python is recommended often.
- One of these days I'll do a comparison between his selection.
- Welp. I take that back. Learn Python the Hard Way USED to be free. Luckily for us we have library access to the full version of the book.
- While it's not exactly Python, I have seen edx.org's CS50's Introduction to Computer Science highly recommended on the internet among beginner programmers. My favorite thing about the course is it appears to be updated yearly.
Chapter 2: Core Programming Syntax
Reference: https://docs.python.org/3/library/functions.html#inputChapter 3: Variables and Data Types
Reference: https://docs.python.org/3/tutorial/introduction.htmlChapter 4: Writing Conditional Code
Reference: https://docs.python.org/3/tutorial/controlflow.htmlChapter 5: Modular Code
Reference: https://docs.python.org/3/tutorial/controlflow.html#defining-functionsChapter 6: Iteration: Writing Loops
Reference: https://docs.python.org/3/tutorial/controlflow.html#break-and-continue-statements-and-else-clauses-on-loopsChapter 7: More About Strings
Reference: https://docs.python.org/3/tutorial/introduction.html#stringsRegular Expressions: https://developers.google.com/edu/python/regular-expressions
Chapter 8: Collections
Reference: https://docs.python.org/3/tutorial/datastructures.htmlSee Also: https://docs.python.org/3/library/array.html
Chapter 9: Style Guidelines
Reference: https://www.python.org/dev/peps/pep-0008/We already talked about Pythonic code. PEP 8 is currently accepted style guide. Brace style is a hotly debated topic and IMO it just depends on your personal preference. Usually a good text editor or IDE will minimize confusion and maximize readability despite your personal preferences.
Chapter 10: Input and Output
Reference: https://docs.python.org/3/tutorial/inputoutput.htmlJavaScript is more commonly used than Python in web development (and my preferred scripting language for web dev as well). Nothing to add for the web development section. I'm going to skip this section as well since repl.it is a cloud IDE.
Chapter 11: Into to Debugging
Tracing and commenting are certainly useful. But debug mode and unit tests are so involved that they are their own topic (and even career). I don't know which IDE we will be using in class yet, so no point in elaborating too far. I enjoy Visual Studio Code a lot but it seems like Jupyter Notebook is more widely used in the data science field.Chapter 12: Into Object Oriented Languages
Reference: https://docs.python.org/3/tutorial/classes.htmlChapter 13 & 14 Advanced Topics
As mentioned in the course, when done well C is incredibly useful for efficient memory management. One of SAS's greatest advantages is its ability to handle big data and large data sets. I recently discovered that SAS is written in C, which would explain its speed advantage over its competitors.In 1985, SAS was rewritten in the C programming language. - https://en.wikipedia.org/wiki/SAS_(software)
As another example to illustrate these last two lectures, Hadley Wickam, prolific author of wideley used R libraries, published freely available books Advanced R and R Packages. Both books cover techniques that connect R and C++. His libraries (my favorite is a package collection called tidyverse) is incredibly efficient.
To highlight the importance of packages, R will choke/freeze/take forever on large data sets but teams of programmers are constantly working on R to make it better. Matt Dowle et all's library package data.table package reads large files in a fraction of the time using the fread() function.
You may wonder why I'm not using SAS even though I love it so much. SAS is expensive, closed source software that my current employer doesn't own. Regarding concerns that open source R and Python will overtake SAS in popularity... You heard yourself in the video series established languages like Fortran and Cobol are still widely used despite their waning popularity. I anticipate the same will hold true for SAS. SAS has been the industry leader for decades and other languages will have a lot of catching up to do both in infrastructure and maturity. SAS's power and complexity is one of the reasons why it is still the industry standard and a valuable skill to have. Regardless, one can never have too much knowledge. Even experienced SAS programmers will sometimes go to R for certain tasks, and it is beneficial to know the basics of all three of these languages.
Quick learning resource honorable mentions (paid resources), Muarch's Python Programming is oftenly highly recommended as a great Python resource, and it's unfortunately not in TAMU's library. Learn to Code the Hard Way's recently released C programming book has the description Learn to think like the computer hates you, because it does." Which is simply hilarious. You'd understand if you've ever worked with C. I'm notoriously bad at finishing all the programming books I horde but if I ever get around to them I'll definitely write about it.
I hope this post was helpful! I'm also a Python newbie so feedback is appreciated from anyone more experienced.
---
Jennifer Cai
Jennifer is a Masters student in the College of Science's Analytics program.