functional or object-oriented?

bruno modulix onurb at xiludom.gro
Tue Sep 20 04:16:33 EDT 2005


beza1e1 wrote:
> This nails it down, yes. :)
> 
> I probably was too deep into OOP thinking-mode to work pythonic. So i
> am now rediscovering the python way.
> 
> Have you read Paul Grahams On Lisp (or was it one of his essays)? He is
> strongly in favor of functional programming.

Yes, but this does not implies that FP is the main trend in CommonLisp.
I discussed that point some years ago on c.l.lisp, and it turned out
that Paul Grahams POV was not perceived by the communauty as
representative of the most common usage of CommonLisp.

> Mainly because Lisp favors
> it. 

While being the father of FPLs, CommonLisp is not a 'pure' FPL, and
clearly a multiparadigm language. BTW, it's object model is probably one
of the most astonishing I've seen.

> He does say though, simulations and CAD programs are inherently OO.
> But now i am writing a game modelling engine, i find objects are not
> the best way anytime in these fields either.

Ok, but keep in mind you're using Python, not Lisp. While supporting
some FP features (first class functions, nested functions, closures,
list expressions, generators, and (a very restricted kind of) anonymous
functions...), Python is still a 'pure' OOPL (ie : everything's an
object). Not using the *class* statement when there's no use for it
doesn't mean not using *objects*. One of the pre-requisites for FP is
first-class functions, and Python provides this by defining functions as
instances of class function. So even the most FP Python programs are
still OO, at least under the hood !-)

My 2 cents
-- 
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in 'onurb at xiludom.gro'.split('@')])"



More information about the Python-list mailing list