Re: [Edu-sig] general newbie guidance
by Kirby Urner other posts by this author
Aug 6 2001 7:44PM messages near this date
[Edu-sig] general newbie guidance
|
[Edu-sig] re: PythonScript
Hi Jeffry --
I'm curious what platform your students will have,
the ratio of students to computers, the presence or
absence of a network, connection to the internet etc.
I reason I ask is that I think it'd be nifty to
demonstrate object-oriented thinking using very simple
classes and subclasses, just to give the idea of what
it means to inherit functionality by subclassing, then
turn to something more complicated like others here
have posted about: e.g. maybe subclass FancyURLopener
in urllib:
> >> import urllib
> >> class Pyorg(urllib.FancyURLopener):
"""
Does little except demonstrate inheritance with
overriding, invoking parent class methods
"""
def __init__(self):
self.parent = self.__class__.__bases__[0]
self.parent.__init__(self)
self.geturl = "http://www.python.org/"
self.getfile = "index.html"
def retrieve(self):
"""invoke parent version with preset args"""
return self.parent.retrieve(self, self.geturl,self.getfile)
> >> myopener = Pyorg()
> >> local = myopener.retrieve()
> >> local[1].dict # local[1] is a mimetools.Message instance
{'last-modified': 'Fri, 03 Aug 2001 21:08:05 GMT',
'content-length': '12098', 'etag': '"5a7510-2f42-3b6b12b5"',
'date': 'Mon, 06 Aug 2001 19:33:53 GMT', 'accept-ranges':
'bytes', 'content-type': 'text/html', 'connection': 'close',
'server': 'Apache/1.3.20 (Unix)'}
> >> myopener.close()
By going back and forth between simple abstractions (yet
hands-on), and stuff with a "real world" feel, I bet you can
refine student understanding without dampening their initial
enthusiasm.
Given how much Python source is included in the Standard
Library, I think just popping some of the modules and
eyeballing them, to get a feel for what full-blown
Python really looks like, would be helpful, as a kind
of before/after test (do it towards the beginning of
the course, then again towards the end -- students should
feel a difference, in the sense of increased readability,
more comprehension on the 2nd or 3rd pass).
I think a key question facing any teacher of the topic
is how much coding she or he might want to do ahead of
time, and make available in module form. Just having
student names in a dictionary, or a Student class with
students instantiating personal objects, filling in
various fields (e.g. fill in birth date, use object.age()
function to get back current age to the day), might help
personalize the experience.
In addition, there's a question of whether you'll want
to be doing stuff on the web, i.e. doing exercises or
background readings/links in HTML in support of this
class. In my ideal classroom, there's a computer projector,
so the teacher can show (a) web pages (b) Python in
interactive shell mode (c) Python code in IDLE's or
some other text editor etc.
Another question is how to balance using power tools as
black boxes (e.g. pre-written modules, perhaps with
subclassable classes) and how much basic background material
to explore. Learning about bits and bytes, variable types,
the built-in data structures, and looking at a few algorithms
in detail, is certainly one way to go. Math-heavy and math-
lite also mark two ends of a spectrum. Do your students
need background in hexadecimal numbers? Probably, as K-12
often fails to cover this highly relevant topic nowadays.
Just thinking out loud here, and not claiming to have the
answers. Like you, I'm curious about what results teachers
in the field are getting. Most of my teaching has been
over the internet with unseen others -- when I do one on
one stuff, it's usually not around using Python directly.
Kirby
_______________________________________________
Edu-sig mailing list
Edu-sig@[...].org
http://mail.python.org/mailman/listinfo/edu-sig
Thread:
Jeffry Babb
Kirby Urner
|