Date: Wed, 18 Apr 2007
From: "Kirby Urner" <kirby.urner@gmail.com>
Subject: Recap of Python Presentation

Sir Don suggested I recap my tonight's Wanderers presentation
for the membership.

OK, here goes:

Python Nation
by Kirby Urner
April 17, 2007

Python evolved from ABC, other influences, provides both
interactive and runtime environments.

My demo focused on the interactive feature, exercising
dir() and type(), importing a little, defining a little,
ending with a generator or two.

The Dog class (below) took up the bulk of the time, with
analogies made from this user-defined class, to the
built-in types integral to Python, e.g. lists, sets,
dictionaries, integers, decimals and so on.


# globals

BenevolentDictator4Life = 'Guido' # PEPs, PSF, Community...

ComputerProgramming4Everybody = 'CP4E' # DARPA (-> IDLE)

# module /site-packages/don.py ----------------------

# contrasted with barry.py alternative Dog class, to

# show how name collisions might become a problem

class Dog:
    My funky dog class

    def __init__(self, name):
        """... a dog is born..."""
        self.name = name
        self.stomach = []

    def eat(self, food):
        # unraveled = self.__digest(self) **


    def __digest(self):
        """code to unravel some plate of food"""

    def poop(self):
        return self.stomach.pop(0) # FIFO

    def __repr__(self):
        return "I'm a dog named " + self.name

    def __add__(self, other):
        return Dog(self.name + "-" + other.name)

so then you would go like:
>>> from don import Dog
>>> mydog = Dog('Rover')
>>> myotherdog = Dog('Fido')
>>> mydog.eat('slice of pumpkin')
>>> mydog.stomach
['slice of pumpkin']

# module site-packages/bill.py ----------------------

# stuff we did in response to bill's queries:

joe = raw_input("Give me a number ")
mary = raw_input("...and another...? ")

whatop = raw_input("what operation?")

print joe + whatop + mary

print eval(joe + whatop + mary)

import this # discuss importance of 'namespace' ***


** David Feinstein suggested unraveling, after I introduced
a plate of food consisting of list-embedded lists (e.g.
[['peas','carrots'],['jello'],['crackers','cheese']] ),
but we didn't actually implement the algorithm during class.

We also talked about the difference between tcp (checked
receipt) and udp (user datagram) within the tcp/ip layer
of the Internet, atop which layer ride the protocols:
http; nntp; ftp; smtp and so on. Apps use these protocols
to facilitate email, news, web and so on.

*** example of namespaces:


i.e. each has a meaning for '4d' and using dot notation,
we're better able to keep unwanted name collisions from

The plan here is to go more deeply into Python on some
subsequent Thursday evenings, not necessarily consecutive,
and not in conflict with any ISEPP lectures, around the
Pauling House table. That's as far as we got tonight.

I start teaching this stuff professionally on Saturdays
for Saturday Academy and might delay further adult
sessions until I've discharged these official duties.
On the other hand, there's a lot to be said for
simultaneity sometimes.

Notice how Yahoo eGroups tends to get rid of indentation,
which is a problem when displaying Python code, as indenting
is part of the grammar.

Here's another archived version of the recap that keeps the
indenting intact:


Also, Don sent me a link to Scripting Languages at Wikipedia
earlier, apropos of our discussion tonight, of the difference
between 'system' and 'agile' languages. I wanted to echo
Wikipedia's use of 'dynamic' in this context, by quoting its
list of 'dynamic languages':

General-purpose dynamic languages

Some languages, such as Perl, began as scripting languages but were
developed into programming languages suitable for broader purposes.
Other similar languages -- frequently interpreted, memory-managed, or
dynamic -- have been described as "scripting languages" for these
similarities, even if they are more commonly used for applications
programming. They are usually not called "scripting languages" by
their own users.

Tcl (Tool command language)

I myself have only looked at a small fraction of these, plus
my beloved FoxPro isn't mentioned. Hospitals use MUMPS (M)
a lot, including Sisters of Providence where I work as a
programmer (but not as an M programmer).

Note Tcl. As I discussed in my presentation, Python's IDLE
sits atop Tk, the widgets library originally coupled with Tcl.
That's how Guido devised our out-of-the-box IDLE that runs
across platforms (his Tkinter module is a bridge between
Python and Tk).


# code highlighted using py2html.py version 0.8