Unification of Methods and Functions

David MacQuigg dmq at gain.com
Mon May 24 18:22:13 EDT 2004


On 24 May 2004 19:44:32 GMT, bokr at oz.net (Bengt Richter) wrote:

>On Fri, 21 May 2004 05:08:20 -0700, David MacQuigg <dmq at gain.com> wrote:
>
>>On Fri, 21 May 2004 13:45:52 +1200, Greg Ewing
>><greg at cosc.canterbury.ac.nz> wrote:
>>
>>>David MacQuigg wrote:
>>>> I'm still waiting for that one simple example that you say will do it
>>>> all, and do it right.
>>>
>>>I don't think you should be trying to cram all the features
>>>of OOP into a single example.
>>
>>I agree.  Digestible chunks is the right approach.  Animals_1.py is
>>the first example of classes, including data, methods, instance
>>variables, and inheritance.  Thats a pretty large chunk, but what
>>makes it digestible is the student's prior knowledge of modules,
>>functions, and all forms of data.
>>
>>Animals_2a1.py (the current version) adds more levels to the
>>hierarchy, a special method __init__, static methods, bound and
>>unbound methods, the odd scoping rule for class variables, and
>>_private variables.  This is all the basics that students will need if
>>they will be writing their own classes.
>>
>>There probably won't be an Animals_3, but instead, "level 3" will be a
>>bunch of examples to illustrate various techniques, like the robust
>>programming that JM has been pushing, and maybe some topics from
>>chapters 21 - 23 of Learning Python.
>>
>>>Also, I worry that the zoo topic will seem contrived. Why
>>>not base your examples on some real problems from your
>>>audience's subject area?
>>
>>Given the goals of the level one and two examples ( cover all the
>>basic features in two simple examples ) I think any example will be
>>contrived.  The level 3 examples will be the right place to introduce
>>real circuit design problems.
>>
>If you take some wood and saw off pieces to make a box
>with some fasteners, and then you put the leftover pieces
>of wood *in* the box, you have pieces of wood with two different
>kinds of relationship to the box.

Spoken like a Zen Master :>)

>I suspect reflecting on this distinction in terms of your examples
>might be fruitful.
>
>I can't spend the time to participate more than stolen moments right now,
>so I haven't seen all of the thread. Sorry if I am rehashing something.

No need for appologies.  I appreciate any and all suggestions.  Even
better -- a sample program that you think would be right for
introducing students to Python OOP.  This can be a piece to add to the
existing box, or even an alternative box.  There is room for both.

-- Dave




More information about the Python-list mailing list