Unification of Methods and Functions

Antoon Pardon apardon at forel.vub.ac.be
Tue May 25 03:08:37 EDT 2004


Op 2004-05-22, David MacQuigg schreef <dmq at gain.com>:
> On Sat, 22 May 2004 18:28:33 -0000, "Donn Cave" <donn at drizzle.com>
> wrote:
>
> This is OK for the first example.  I would leave the __init__ methods
> to the second example, but either way it will take about 8 pages to
> comfortably explain OOP ( maybe ten if I include the "robust
> programming" examples that JM says I must ).  I would like students to
> understand Python at the level they can follow what is going on in a
> real program, and maybe write a few classes themselves.
>
>>Then I would go over that, showing what happens and why, until the
>>concepts introduced above seem to be clear for everyone.  That would
>>conclude my treatment of classes.  As an elementary language, there
>>are some slightly hard things to learn about Python, but this isn't
>>going to be one of them unless you make it hard.
>
> If you are saying we can totally ignore the different method forms, I
> think you are wrong.  Bound and unbound methods, for example, will be
> needed in almost any sizable program.  The need for static methods
> will arise when the student first writes a method that needs to work
> without a current instance.

He doesn't need a method for that. He can just write a function.

Why do you want to write a method in circumstances that call for
a function?

-- 
Antoon Pardon



More information about the Python-list mailing list