Programming: Python esssentials (some notes)

  • python icon article | Oxford only

Why Learn Python?

In my experience Python is one of the easier languages to learn and due to its syntax it helps to provide a solid foundation in good coding practice.

Python is a scripting language which means that you can quickly make changes to your program to make sure that it works and you can run an unfinished program to make sure that what you have written so far is correct. You can make any program that you want in Python and it will port between computers without the need to recompile or to make modifications to the code. While Python is easy to learn, it also provides high level support for advanced topics such as Object Oriented Programming (OOP) and Database Access.

Python is also very popular in many scientific fields for its ease of use and quick development time.

What is Python? (excerpt taken from python.org)

Python is an interpreted, object-oriented, high-level programming language with dynamic semantics. Its high-level built in data structures, combined with dynamic typing and dynamic binding, make it very attractive for Rapid Application Development, as well as for use as a scripting or glue language to connect existing components together. Python's simple, easy to learn syntax emphasizes readability and therefore reduces the cost of program maintenance. Python supports modules and packages, which encourages program modularity and code reuse. The Python interpreter and the extensive standard library are available in source or binary form without charge for all major platforms, and can be freely distributed.

Often, programmers fall in love with Python because of the increased productivity it provides. Since there is no compilation step, the edit-test-debug cycle is incredibly fast. Debugging Python programs is easy: a bug or bad input will never cause a [critical error]. Instead, when the interpreter discovers an error, it raises an exception. When the program doesn't catch the exception, the interpreter prints a stack trace. A source level debugger allows inspection of local and global variables, evaluation of arbitrary expressions, setting breakpoints, stepping through the code a line at a time, and so on. The debugger is written in Python itself, testifying to Python's introspective power. On the other hand, often the quickest way to debug a program is to add a few print statements to the source: the fast edit-test-debug cycle makes this simple approach very effective.