Unification of Methods and Functions

David MacQuigg dmq at gain.com
Sun May 23 23:25:51 EDT 2004


On 23 May 2004 06:18:54 -0700, moughanj at tcd.ie (James Moughan) wrote:

>David MacQuigg <dmq at gain.com> wrote in message news:<pndva0hi800r5c132j22jv42djd36not8m at 4ax.com>...
>> On 22 May 2004 11:50:18 -0700, moughanj at tcd.ie (James Moughan) wrote:
>> 
>> >David MacQuigg <dmq at gain.com> wrote in message news:<9hgpa0d2iq5bb2ko4sngs5i6v4og90vqej at 4ax.com>...
>> >> On 19 May 2004 23:26:38 -0700, moughanj at tcd.ie (James Moughan) wrote:
>> >> >David MacQuigg wrote:
>>  
>> >> I like your example, but not as a *substitute* for Animals_2.  It's
>> >> just too complex for non-CIS students at this point in the course.  I
>> >> think I understand your concerns about Animals_2.  I think the best
>> >> way to deal with those concerns is not by complicating the example, or
>> >> by taking out everything that could lead to problems, but rather by
>> >> pointing out the problems, and showing subsequent examples that fix
>> >> those problems, even at the expense of more complexity.
>> >> 
>> >> If you have a simple all-in-one alternative to Animals_2, show me.
>> >> 
>> >
>> >Again, clearly I have not communicated myself well - I mean a
>> >*completely* different example to the entire Animals approach.  The
>> >difficulty with writing a good Animals-type example comes from the
>> >things which it is trying to do, which aren't especially well
>> >expressed by a class-heirarchy.
>> 
>> What I am trying to do in Animals_2 is provide the simplest, most
>> learnable example of Python OOP, which has at least one of every basic
>> structure the students will encounter in a real program.  So I include
>> bound, unbound, and static methods, but not metaclasses or
>> descriptors.
>> 
>> Creating a good example like this is turning out to be more of a
>> challenge than I expected.  I'm fairly happy with Animals_2, but I
>> appreciate the "maintainability" problems you have pointed out, and
>> have added footnotes accordingly.  The examples in Learning Python are
>> too spread out in little pieces, and of course, no attention to the
>> issues you are concerned about.  If you know of another place I can
>> look for a good all-in-one teaching example, I am interested.
>> 
>
>Just for the sake of example, this is one of the programs which I
>always write while learning a language, written in a way I'd use to
>demonstrate OO; all it does is read in a wordlist, then print out
>synonyms for user-inputed words.  Handy for crosswords. ;-)

<snip examples>

I've posted these examples on our webpage at
http://ece.arizona.edu/~edatools/Python/Examples  Let me know if I
should make any changes.  These will be very helpful for students to
see alternative styles in programming.

-- Dave




More information about the Python-list mailing list