Last Friday afternoon I was set a challenge - to present Python in three hours to a group of 20 very experience programmers who, however, knew nothing about this particular language.

The session was in Central London - my directions started off with "Get off the Tube at Oxford Circus", so Londoners will know just how central I mean - so I took First Great Western's Penzance express from Westbury into Paddington. It's great to have power at your seat for laptops these days, though the new airline style seats in second class (oops - standard class!) are a bit tight for working on, and the computer jump horribly when the guy in the seat ahead gets up or flops down.
"Python in a nutshell" - no - that's NOT what I entitled the talk, but I went through the various features that will be mainstream for this group (I had had their applications described to me ahead of time), and I concluded with an example which - in less that 1500 bytes including comments - shows a short and simple use of many of the features os the language.
• Variables and Loops
• Comments
• Lists, Tuples, Dictionary
• Functions, Modules, Object use
• Variable scope
• Documentation Strings
• Regular strings, triple quoted strings and raw strings
• Regular Expressions
• Formatted String Outputs
• File Statuses and File Handling.
• Prompting and reading from STDIN
• Exception handling and error exiting
In some horror, I notice that my example doesn't have a single
if statement in it but - hey - I don't think I did too badly in getting so much in to a practical piece of code ...
[source code here]
grahamellis$ python lfan
This is a program which reads a web server access log
file and counts the number of times each browser has
visited, outputting the results sorted by the number
of accesses
Press return to proceed
Processing 13973 kbytes
1 pd95215e4.dip.t-dialin.net
1 cache-ntc-ab01.proxy.aol.com
1 host-66-81-36-237.rev.o1.com
1 cache-mtc-al03.proxy.aol.com
[snip]
306 sjcd-webcache-3.cisco.com
309 193.116.20.220
327 crawler10.googlebot.com
348 crawler14.googlebot.com
407 ip68-110-77-129.ph.ph.cox.net
970 82-33-81-221.cable.ubr03.trow.blueyonder.co.uk
Total of 67756 visits from 5048 hosts
grahamellis$
How did the afternoon go? Well - I enjoyed it and my whole audience remained, right through to a quarter past five when I finished. A handful of excellent questions afterwards. And a comment from my contact there, who isn't technical himself and had meetings during the afternoon - "Graham - I came back at about five and looked in through the window. The degree of concentration after three hours from
everyone was quite remarkable".
(written 2008-06-01)
Associated topics are indexed as below, or enter http://melksh.am/nnnn for individual articles
Y205 - Further uses of Python [190] Python engines - (2005-01-26)
[595] Add a friendly front end with Tk - (2006-02-08)
[745] Python modules. The distribution, The Cheese Shop and the Vaults of Parnassus. - (2006-06-05)
[1036] Python Qt, wX, TkInter, and Jython - training?? - (2007-01-16)
[1340] Tk locks up - 100% c.p.u. on a simple program (Tcl, Perl, Python) - (2007-09-09)
Y101 - Introduction to Python [317] Programming languages - a comparison - (2005-05-20)
[380] Bridging to the customer requirement - (2005-07-16)
[382] Central London Courses - Perl, PHP, Python, Tcl, MySQL - (2005-07-18)
[444] Database or Progamming - which to learn first? - (2005-09-13)
[629] Choosing the right language - (2006-03-01)
[710] Linux training Glasgow, Python programming course Dundee - (2006-05-05)
[712] Why reinvent the wheel - (2006-05-06)
[753] Python 3000 - the next generation - (2006-06-09)
[834] Python makes University Challenge - (2006-08-15)
[846] Is Perl being replaced by PHP and Python? - (2006-08-27)
[909] Python is like a narrowboat - (2006-10-30)
[949] Sludge off the mountain, and Python and PHP - (2006-11-27)
[950] Python and the Magic Roundabout - (2006-11-27)
[1375] Python v Ruby - (2007-10-02)
[4118] We not only teach PHP and Python - we teach good PHP and Python Practice! - (2013-06-18)
[4298] Python - an interesting application - (2014-09-18)
[4590] Progress on moving from Python 2 to Python 3 - training for both versions - (2015-12-01)
G997 - Well House Consultants - Newsletter Lead Articles [1000] One Thousand Posts and still going strong - (2006-12-18)
[1065] Graham Ellis - an Introduction - (2007-02-05)
[1136] Buffering output - why it is done and issues raised in Tcl, Perl, Python and PHP - (2007-04-06)
[1224] Object Relation Mapping (ORM) - (2007-06-09)
[1318] Well House Manor - feature comparison against the old place! - (2007-08-24)
[1386] New software product for warmblooded programmers - (2007-10-10)
[1488] New trainee laptop fleet for our Open Source courses - (2007-12-30)
[1545] Letting new visitors know we provide training courses - (2008-02-19)
[1600] Cambidge - Tcl, Expect and Perl courses - (2008-04-04)
[1754] Upgrade from PHP 4 to PHP 5 - the TRY issue - (2008-08-15)
[1819] Calling base class constructors - (2008-10-03)
[1912] Book now for 2009 - (2008-11-29)
[2052] How was my web site compromised? - (2009-02-24)
[2119] Make your business a DESTINATION business - (2009-04-05)
[2253] Walks in and around Melksham, Wiltshire - (2009-06-21)
[2370] C++, Python, and other training - do we use an IDE - (2009-08-21)
[2425] Weekend and Christmas Promotion - Well House Manor Hotel, Melksham - (2009-09-26)
[2538] Open Source Training Centre and Courses for 2010 - (2009-12-16)
[2743] Public Open Source Training Courses running this summer and autumn in Melksham - (2010-04-27)
[3202] Telling you something about us in just one line - (2011-03-15)
Some other Articles
Checking server performance for PHP generated pagesSlow boot and terminal start on Linux boxesFactory method example - PerlExample of OO in PerlPython in an afternoon - a lecture for experienced programmersWestonbirt Arboretum PostcodeEquality, sameness and identity - PythonKorn shell - some nuggetsString, Integer, Array, Associative Array - ksh variablesSome useful variables and settings in the Korn Shell