Why functional Python matters
ramen at lackingtalent.com
Wed Apr 16 01:04:06 CEST 2003
In article <3E9C9A91.8090209 at removethis.free.fr>, laotseu wrote:
> Even for OO programmers, functionnal features in Python are IMHO a great
> plus, and BTW functionnal and OO paradigm does not have to conflict
> (that would be functionnal vs imperative and object vs procedural). CLOS
> is one of the great system objects out here, and it's been implemented
> on top of a functionnal language, so...
This is a good point. O'Caml comes to mind as well--a functional language
with object support right out of the box. There is no reason the two
methodologies need to be mutually exclusive, or step on each other's toes.
But, there is of course the risk of setting precedent that there are more
than one ways to do it, and this is why I brought up Perl. I think that
there is a subtle fear in the Python community of letting Python become too
much like Perl, especially since both languages have similar application
domains. There are other options besides TMTOWTDI and military rigor. This
is precisely why I like Python, because it seems to be a good compromise
between the two.
I think that list comprehensions bridge the gap somewhat between FP and OO
methods, and this is one thing I really like them for. For instance:
[obj.method(x) for x in data]
looks nicer to me than:
map(lambda x: obj.method(x), data)
because it puts the emphasis on the method call, not the variable.
> In fact, I'd rather regret that Python is not more functional *and*
> object oriented !-)
In what ways? =)
Thanks for your input,
More information about the Python-list