Mailing List Archive
tlug.jp Mailing List tlug archive tlug Mailing List Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [tlug] ruby and python in Japan
- Date: Mon, 26 Feb 2007 14:20:02 +0900
- From: "Zev Blut" <zb@??>
- Subject: Re: [tlug] ruby and python in Japan
- References: <45E16CA8.email@example.com> <20070225122334.GA10626@example.com> <firstname.lastname@example.org> <email@example.com> <firstname.lastname@example.org>
- Organization: Ubiquitous Business Technology, Inc.
- User-agent: Opera Mail/9.02 (Linux)
On Mon, 26 Feb 2007 13:33:17 +0900, Stephen J. Turnbull <stephen@??> wrote:
Zev Blut writes:
> Well, this is not restrictive but an annoying aspect is that you must > explicitly declare self in all of your instance methods. It makes the > OO aspect of Python feel tacked on.
Ah, you haven't drunk the Kool-Aid. This is an instance of "explicit is better than implicit." I think you should check your mental model of OO. I'm not saying that your annoyance is unwarranted---whatever makes you more productive works for me. My point is that OO and implicit arguments are independent constructs.
I am sorry but I must disagree, this simply reeks of an implementation detail. Now I know this technique is very useful when using languages that do not have OO built in yet can easily implement it, but I really have to disagree with this being an instance of "explicit is better than implicit".
> Also, Rails does some fun stuff with dates and numbers such as > "5.days_from_now".
In Python you could spell that
from DateTime import date
five_days_from_now = date.today() + 5
So you're exactly right; it's "fun", but lack of it doesn't hinder serious work by very much. How much? This much: you'd like to write
from DateTime.date import today
later = today() + 5
but today is overloaded:
from DateTime.datetime import today
later = today() + 5
The Ruby version does have the advantage that by monkey-patching the Integer class you can put the units in the method name. I'd have to work with it to decide whether that's a convenience or a trap for me.
As you know your above examples also work in Ruby. You are correct that there is no need for something like "5.days_from_now". I have yet to use it and many Japanese Ruby developers like to huff and haw about Rails addition of these methods, but users seem to like it.
Anyway, I don't want to get into a language war so I will end it with this. I think Ruby and Python have a number of similar attributes, but that Ruby has a significantly stronger OO model and other techniques like blocks and lambdas that make it a bit strong than Python. I have looked at Python, but since I know Ruby I do not find it compelling to learn unless I am going to be paid to do it. Granted I am happy to steal good ideas from Python and its' libraries, such as various concepts in Django and such. The next languages I would probably spend more time in are Objective C, Smalltalk, Haskell, Lisp and Erlang. Where currently Haskell and Erlang are interesting to me due to the significantly different model of programming.
- Re: [tlug] ruby and python in Japan
- From: Stephen J. Turnbull
Home | Main Index | Thread Index
- Prev by Date: Re: [tlug] ruby and python in Japan
- Next by Date: Re: [tlug] ruby and python in Japan
- Previous by thread: Re: [tlug] ruby and python in Japan
- Next by thread: Re: [tlug] ruby and python in Japan
Home Page Mailing List Linux and Japan TLUG Members Links