>>>>> "Hal" == Hal Fulton <hal9000 / hypermetrics.com> writes:

    Hal> I'd have to disagree. join, since it produces a string, obviously
    Hal> knows about strings even though it is not a string method.

And hence, the sequence knows about strings. The Ruby approach is
making a special case of strings, while the Python approach doesn't.

I'm not saying this is a question of big importance - we have lots of
people in Python camp who don't like ''.join() either. It just seems
most sensible for me, even if it isn't obvious for newbies. I think
it's a situation where Python errs on the side of pure OO instead of
practicality.

    Hal> As for x.y, I think it general we are "performing operation y
    Hal> on object x" -- and it seems clear to me that join is NOT
    Hal> acting on ' ' (which is only a single item anyway).

But that's context dependent knowledge. Python is very explicit and
always requires () which is a 'call' operation on an object. I think
that's a very small price to pay for first class functions.

    Hal> I don't know FP either, but I thought method chaining was an
    Hal> important part of it. Because of the disconnect I mentioned
    Hal> earlier (where join is not actually acting on its receiver),
    Hal> the previous example doesn't show true method chaining.

Yes, but join is an isolated special case. We get to chain all the
time in Python too. Join would have been added as a method for
sequences already if it was deemed critical - believe me, there have
been heated discussions. So far, I think we've been doing the right
thing.

    Hal> As for the parens: I've never missed first class functions in
    Hal> Ruby.  Maybe I should. But I prefer the uniform access
    Hal> principle if I have to choose between that and fcf.

But you don't know that yet :). What practical benefits do you get
from the uniform access principle, and what do you mean by it?

    Hal> Let's channel this discussion more productively: Why should I want
    Hal> first-class functions? Honest question, no sarcasm.

You can just pass functions directly to anything that wants a callable
object. Functions and methods are objects like everything else, you
can pass them around and store them any way you want.

You can use higher order functions, which is critical for FP.

Check out Functional Programming in Python article series at

http://www-106.ibm.com/developerworks/linux/library/l-prog3.html

if you want to learn more (the article has links to parts 1 and 2).

BTW, I don't consider first class functions anything "special", it's
just a logical result of the everything-is-an-object paradigm.

Alex Martelli really says most there is to say about comparing Ruby
and Python in the usenet article that was linked to in the UserLinux
comparison page, but here it is again:

http://groups.google.com/groups?selm=bhqr78021hp%40enews1.newsguy.com

-- 
Ville Vainio   http://tinyurl.com/2prnb