A Python 3000 Question

Steven D'Aprano steve at REMOVE-THIS-cybersource.com.au
Tue Oct 30 15:09:39 CET 2007


On Tue, 30 Oct 2007 00:11:58 +0000, Marc 'BlackJack' Rintsch wrote:

>>> And to answer the question. In OO programming generic functions are no
>>> less important than classes and objects.
>> 
>> Do they not take away from the OOness of the overall language and
>> introduce inconsistencies?
> 
> No not at all.  Why do you think so?

I disagree. I think they *do* take away from the overall Object-Oriented 
nature of the language, and that is A Very Good Thing Indeed.

OO is a tool, and like any tool, it has it's uses and misuses. Some 
things are best written as objects, some as imperative procedures, some 
as functions. As you say:

> There are things that are best expressed as functions.

Agreed. It is a *good thing* that Python doesn't try to be 100% 
functional, or 100% Object Oriented, or 100% procedural.

(Aside: I think it a shame that there is one major paradigm that Python 
doesn't have *any* support for at all: logic programming, like Prolog. I 
don't quite know what it is good for, but I'd like to find out!)


> Other allegedly more OO languages have them
> too, but you need to stuff them as static methods into classes or even
> uglier you see code like ``Spam().spammify(eggs)`` instead of a plain
> function call.


I'm reminded of a very famous proverb from the Kingdom of the Nouns:

For the lack of a nail,
    throw new HorseshoeNailNotFoundException("no nails!");

For the lack of a horseshoe,
    EquestrianDoctor.getLocalInstance().getHorseDispatcher().shoot();

For the lack of a horse,
    RidersGuild.getRiderNotificationSubscriberList().getBroadcaster().run(
      new BroadcastMessage(StableFactory.getNullHorseInstance()));

For the rest of the proverb, which is well worth reading, you'll have to 
see here:


http://steve-yegge.blogspot.com/2006/03/execution-in-kingdom-of-nouns.html



-- 
Steven.
(no, not that Steve in the URL)



More information about the Python-list mailing list