[Edu-sig] FW: Recap of tonight's presentation re Python @ Pauling House, Hawthorne, PDX

kirby urner kirby.urner at gmail.com
Wed Apr 18 08:48:30 CEST 2007


"""

>From kirby.urner at gmail.com Tue Apr 17 22:55:14 2007
Return-Path: <kirby.urner at gmail.com>
X-Sender: kirby.urner at gmail.com
X-Apparently-To: wwwanderers at yahoogroups.com
Received: (qmail 34588 invoked from network); 18 Apr 2007 05:55:05 -0000
Received: from unknown (66.218.66.166)
by m43.grp.scd.yahoo.com with QMQP; 18 Apr 2007 05:55:05 -0000
Received: from unknown (HELO n16.bullet.sp1.yahoo.com) (69.147.64.213)
by mta5.grp.scd.yahoo.com with SMTP; 18 Apr 2007 05:55:05 -0000
Received: from [216.252.122.217] by n16.bullet.sp1.yahoo.com with
NNFMP; 18 Apr 2007 05:54:51 -0000
Received: from [66.218.69.3] by t2.bullet.sp1.yahoo.com with NNFMP; 18
Apr 2007 05:54:51 -0000
Received: from [66.218.66.91] by t3.bullet.scd.yahoo.com with NNFMP;
18 Apr 2007 05:54:51 -0000
Date: Wed, 18 Apr 2007 05:54:49 -0000
To: wwwanderers at yahoogroups.com
Message-ID: <f04br9+7p5b at eGroups.com>
User-Agent: eGroups-EW/0.82
MIME-Version: 1.0
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: quoted-printable
X-Mailer: Yahoo Groups Message Poster
X-Yahoo-Newman-Property: groups-compose
X-Originating-IP: 69.147.64.213
X-eGroups-Msg-Info: 1:6:0:0
X-Yahoo-Post-IP: 76.105.200.117
From: "Kirby Urner" <kirby.urner at 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) **
        self.stomach.append(food)

    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:

coxeter.4d
einstein.4d
fuller.4d

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

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.
"""


More information about the Edu-sig mailing list