[Tutor] methods versus functions (using lists as an example)

Alan Gauld alan.gauld at freenet.co.uk
Wed Oct 20 22:52:23 CEST 2004


> >  This makes Python slightly less elegant than Ruby, but it's quite
> > easy to get the hang of.
>
>
> I don't know Ruby, but I can certainly say that I think that
Python's
> current form (using functions for generic operations and methods
only
> for type-specific operations) is far more elegant than it would be
if
> everything were forced into methods, thus requiring many classes to
> sprout swarms of tiny, repetitious methods...

Yep I'll second that. I have played with Ruby but not done any
serious coding, but I can say that I found several places where
I found myself forced into an "OOP" style of prigramming because
Ruby offrs no alternative, evebn when a functional approach was
more natural.

Java and Ruby both suffer under the delusion that OOP is somehow
a superior paradigm so you should write everything as objects,
but it just aint so. Python usually gets the balance of
function vv objects right (for me at least!)

OTOH Ruby is much better than Python(and Java) at anonymous code
blocks and closures. It really shows up the limitations of Python
lambdas.

Alan G.



More information about the Tutor mailing list