Advice on teaching a 1 day Python class
Paul Watson
pwatson at redlinec.com
Thu May 22 12:12:28 EDT 2003
I would add material and a live demo of using Python interactively to learn
more. I found this capability to be very helpful. This is most effective
when the student's fingers are typing the commands.
=== file amod.py
#! /usr/bin/env python
class A(object):
x = 3 # class attribute, class variable
print "class instantiation x = ", x
def __init__(self):
print "class x 0 = ", A.x
print "self x = ", self.x
self.x = 7 # instance attribute, instance variable
print "class x 0 = ", A.x
print "self x = ", self.x
def show(self):
print "class x 0 = ", A.x
print "self x = ", self.x
if __name__ == '__main__':
print "starting __main__"
i = A()
print "after instantiation"
i.show()
=== end of file amod.py
After creating the file above in the current directory, start an interactive
session and try these commands. Some generate errors intentionally.
s = 'asdf'
type(s)
dir(s)
type(s.startswith)
dir(s.startswith)
print s.startswith.__doc__
s.startswith('a')
s.startswith('x')
import amod
type(amod)
dir(amod)
print amod.__doc__
type(amod.A)
dir(amod.A)
print amod.A.__doc__
type(amod.A.show)
print amod.A.show.__doc__
amod.A.show()
i = amod.A()
i.show()
"djw" <dwelch at vcd.hp.com> wrote in message
news:bagr21$be2$1 at news.vcd.hp.com...
> Hello,
>
> I have been asked (OK, I volunteered) to teach a one day class on Python
to
> a group of software engineers (typ. experience would be C, C++ and/or Java
> programming) at my company. I am fairly experienced with Python and could
> probably come up with some reasonable content, but I was wondering if
> anyone had any nuggets that I could dig up that would get me started? I
was
> thinking that somebody has probably done this before and may have a
> slideset, class notes, or some such thing available for sharing. I have
> just about every Python book available, but I don't really think I could
> get through an entire book in one day, even in condessed form. My goal is
> to get people enough familiarity and confidence to get started using
Python
> on their next project without hesitation. (World domination is a secondary
> goal.)
>
> Any thoughts and/or suggestions?
>
> Thanks,
>
> Don
>
>
More information about the Python-list
mailing list