Unification of Methods and Functions

Donn Cave donn at u.washington.edu
Thu May 6 14:39:01 EDT 2004


In article <qp5k905u0uomcp7o4lnuome7ke5f7emn2h at 4ax.com>,
 David MacQuigg <dmq at gain.com> wrote:
...
> How did you know to add self in Mammal.talk(self)?  This is a perfect
> example of an experienced Python programmer sailing right past a
> problem that trips up less proficient users, and not even being aware
> that the problem exists.  What surprises me is that even after
> pointing out a problem like this, I will get someone telling me --
> It's real simple, dummy.  Mammal is a class.  When you call a method
> from a class, you get an unbound method, which requires an explicit
> 'self'.
> 
> Yes, I know that.  I remember it because I use Python almost every
> day.  My students and clients, three months after learning it, will
> not remember.

Maybe they won't, I don't know.  But if it's difficult, it's
a benign sort of difficulty.  You CAN understand how it works,
you can't use it WITHOUT understanding how it works, and the
more you use it, the more obvious it becomes (sail right past.)
This is what Python is all about - a consistent, explicit
system.  If you're searching for unbearable difficulties, I'd
look for things you can use without understanding, like the
object/reference storage model, and its interactions with
mutable default parameters, +=, etc.

But at any rate, from my perspective, this is your problem,
not your students and clients problems.  I've been hearing
for years from sophisticated users who think they know how
to speak for the unsophisticated users, and after a couple
decades I have come to be highly skeptical.  I've dealt with
scientists myself, and I think I have an idea of what you're
talking about, the principles make sense, but the connection
between the general principles and the specific details ...
a black art.  You're not unique here because you represent
non-programmers, you have a unique idea of how that relates to
the language.  As would anyone.  My own perspective is, present
the core language and leave them to solve problems in that model,
"bad programming" or not.  The static method, for example, is
not really a core concept - not just the implementation, but
the basic principle.  So don't go there.  You'll be surprised
at how little pain they feel over software engineering issues.
Actually, my only Python-using colleague here, really the only
one who actively uses Python for our core software, doesn't even
use "class".

   Donn Cave, donn at u.washington.edu



More information about the Python-list mailing list