a Python person's experience with Ruby
Steve Howell
showell30 at yahoo.com
Sat Dec 8 14:56:51 EST 2007
--- Bruno Desthuilliers
<bdesth.quelquechose at free.quelquepart.fr> wrote:
> Colin J. Williams a écrit :
> > I'm not sure that I like add 3, 5, 7
> >
> > but it would be nice to be able to drop the
> parentheses
> > when no argument is required.
> >
> > Thus: close;
> > could replace close();
>
> This just could not work given Python's object
> model. The parens
> actually *are* the call operator.
>
I mostly agree with you, but in the specific use case
of having just a single token on a line, you could
argue that Python could DWIM on calling an object if
the object is callable, since otherwise it's just a
no-op. I think the argument against doing that is
more based on explicit-vs.-implicit principle versus
actual constraints of the object model.
Another aspect of Ruby is that the final expression
evaluated in a method actually gets returned as the
result of a method, which has further implications on
whether "close" is simply evaluated or called.
____________________________________________________________________________________
Never miss a thing. Make Yahoo your home page.
http://www.yahoo.com/r/hs
More information about the Python-list
mailing list