Show Me Do screen casts

I came across this site, Show Me Do. I must say I am quite impressed. There are a ton of instructional videos or screen-casts on the website, a lot of which cover topics I am very interested in, Python!

The first one I noticed had a kid who was showing how he used a programming environment called Rur-Ple to write and execute his very own program. That is great to see young kids very interested in tools like these. I remember when I was a kid and wrote BASIC program and saved them to a cassette tape. It seemed to take forever to write or read too the tape.

As I began pouring over the videos, I noted some were introductions into Python, IPython, or PyDB. While I use these tools, I am always willing to learn a new trick here or there that I haven’t uncovered yet.

So here is my assessment of the videos I watched, and following a list of videos I haven’t watched yet.

Python Source Walkthrough Series (2 videos)
review of a simple text line matcher (grep). Very basic overview, good for someone new/just learning Python. What I learned? I didn’t know about the %prog argument used in a string, which is replaced with the name of the program automatically. Good review of OptionParser and re (or regular expressions). This video may not be best viewed by someone learning to program for the very first time, as explanations of a variable are not explained.

Keeping in touch python series
ok. Shows a few ways where you can find more information on python using the Firefox browser, with built in search capabilities.

The IPython Interactive Shell
Part 1
I use iPython religiously. I didn’t realize there was a who/whos command, which lists local variables. psearch command for searching variable names. You can use the store command to persist variables between ipython sessions! reset will get rid of the variables. Re-run store -r to bring back the persisted ones. store -z clears out all of the storage of persisted variables.

logstate/logstart/logon – I didn’t realize ipython had logging! lsmagic lists all commands for ipython. ?command lists information about a magic command. ??command returns more information, some cases source code! page prints output pretty/clean. help(module) integrates with pydoc, showing helpful information. help(‘string‘) will display online documentation from python docs. topics will show you help topics about the Python language.

To find a definition for a function use pdef function. Or use pdoc function to show the docstring for the function. pinfo function shows both. Find out what the source code looks like behind the function?…use pinfo function. Open the actual file a function lives in using pfile function.

edit -x function will open the file the function is found in, position it and let you make changes if you have permissions.

Part 2
Covers file system navigation leveraging push/pop and viewing the path stack. Use bookmark to give paths an alias name. Run system commands by prefixing the command with the bang (exclamation mark): !command. See more about alias to set command line alias options including passing parameters. run module/file. Variables are imported locally so further analysis may be performed. run -d program runs the program in the debugger.

Part 3
History of what you entered can be easily reviewed. This is a very helpful when you want to find that function you defined back in the history of your ipython session. Just start typing the line def … and you can use previous to see all history lines beginning with def. hist will show the history of command/lines entered. Macros are also covered in this screen cast. edit 1-3 5 is useful again for editing history lines in your predefined editor. While save apple 1-3 5 can persist those lines to a file named pycat to view source with syntax coloring. Ahh…pasting source from a webpage is easier with cpaste. All output received from running commands are stored in a variable Out. Out[120] will return the stored output from command (in history) 120.

Part 4
This covers debugging/profiling, background threads, etc. Change the exception mode with xmode mode; mode may be Plain/Context/Verbose. pdb will automatically turn on taking you into the python debugger when an exception is raised during execution. debug will take you immediately into the python debugger. You can include the ipython shell in your code, which will bring up ipython, then continue on when you exit the shell.

Profiling: The time command will time how long it takes to run a command. Also included is timeit, which will run the command several times and tell you in a smaller measure of units (e.g. microseconds) averaged. prun will give you details down to the method/command, and how long each took.

Running expressions in the background is possible with the bg command. jobs[0] can return the results.

Part 5
Profiles can be used for physics as well as pylab for plotting.

Overall this five part series on iPython was very helpful. I am going to use a lot of new features when I am next in IPython! I ended up taking more notes than I thought I would.

Still on the screen cast list are:

5 minutes with Python

Django tutorial Part 1

Intro to Python objects using IPython

Introducing the pydb Debugger

VPython – Physics and 3D in Python

Writing Arinoid using PyGame

pyGame Basics


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s