From: David MacQuigg Date: 2004-02-24T04:44:51+09:00 Subject: Re: Need examples comparing Ruby to Python On Mon, 23 Feb 2004 11:20:43 -0500, "Kent S." wrote: >Even though it's nice to know about these small differences in both >languages, I think all these examples miss their target. The biggest win I agree. The differences ended up small because I took the examples from the Programming Ruby book, then updated the Python to a more optimum form, taking advantage of methods added since the book was written. I would like to replace these trivial examples with something showing a more significant difference between these two languages. Then we can answer the question: Do the differences come down to just a few missing methods, which we can add ourselves, or do we really have some fundamental advantages, perhaps enough to move off of Python. >I get when I use Ruby is that it allows me to program at the meta level. >As in Dave Thomas' example, Ruby allows me to do things like this > > class RegionTable < Table > table "region" do > field autoinc, :reg_id, pimary_key > field int, :reg_affiliate, references(AffiliateTable) > field varchar(100), :reg_name > end > end > >which basically means that I can create my own >DomainSpecificLanguage(http://martinfowler.com/bliki/DomainSpecificLanguage.html) >without leaving Ruby. I don't know much about Python but I don't think >it is that easy to do with it. I'm having trouble understanding the goal of this example. That is the key to providing a meaningful comparison. Any language can do esoteric tricks that no other language can reproduce without some difficult coding. The latest version of Python, for example, provides a slight variation on the multiple inheritance method resolution order for rare cases where our parent classes have a common ancestor !! Cool stuff, but will I ever use it? If you need to write a paragraph or two to motivate or explain the goals for an example of some code, we can include these details as a footnote or link on the examples showcase page. They we can try to get the same result in Python, perhaps using an entirely different set of statements. -- Dave > >/kent > >David MacQuigg wrote: > >> I'm putting together a web page comparing Ruby to Python, and I need >> some good examples showing off the advantages of Ruby. I'm new to >> Ruby, so all I've been able to do so far is pick some examples from >> the Programming Ruby book, and do a Google search on "compare ruby >> python". What I've found is way out-of-date. >> >> Take a look at http://userlinux.com/cgi-bin/wiki.pl?RubyPython This >> is part of the UserLinux project, a new Linux distribution that I hope >> will pick up where Red Hat left off, and be easier to install than >> Debian. Python is our chosen "primary" scripting language, but there >> are many participants who are also interested in Ruby. >> >> Thanks for your help. >> >> -- David MacQuigg >>