REPOST: Re: Two languages, too similar, competing in the same space.

HarryO harryo at zipworld.com.au
Thu Dec 27 18:22:56 EST 2001


On Fri, 28 Dec 2001 09:56:29 +1100, Ron Stephens wrote:

> ... But
> now that Ruby is out there, it absorbs enormous mind share, and
> development time to recreate libraries etc., which are already available
> in Python,  thus hurting Python.

I have only tried it in a very minimal way, just to see that it did
basically what was advertised, but you might be interested in this.

There's a Ruby library that allows you to do things like:

   require 'python'
   require 'python/httplib'

   h = Py::Httplib::HTTP.new(host)

   h.putrequest('GET', path)
   h.putheader('Accept', 'text/html')
   h.putheader('Accept', 'text/plain')
   h.endheaders()

Ie, the "require 'python'" makes pulling in Python libraries
as simple as ...

   require 'python/SOME_PYTHON_LIB'

which is almost as easy as doing it in Python.

Similarly, referencing elements of such a library simply
requires prefixing them with "Py::".  Once you have a
handle to a Python object, you call it the same way you
would in Python.  I don't think one could make it much simpler.

So, to some extent, it's possible to avoid reinventing the
wheel.  How well this works, I can't say, just that the
examples I played with worked as advertised.

Obviously, there's some overhead, in that it's running a copy
of the Python interpreter to execute the Python code, but so
long as the work the library is doing for one is larger than
the actual overhead of the call to it, that shouldn't be a
problem.

========= WAS CANCELLED BY =======:
Path: news.sol.net!spool0-milwwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!newsxfer.interpacket.net!news-xfer.nuri.net!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r
From: HarryO <harryo at zipworld.com.au>
Newsgroups: comp.lang.python
Subject: cmsg cancel <pan.2001.12.28.10.23.23.376747.19622 at zipworld.com.au>
Control: cancel <pan.2001.12.28.10.23.23.376747.19622 at zipworld.com.au>
Date: Mon, 31 Dec 2001 01:29:34 GMT
Organization: A poorly-installed InterNetNews site
Lines: 2
Message-ID: <cancel.pan.2001.12.28.10.23.23.376747.19622 at zipworld.com.au>
NNTP-Posting-Host: 211.57.49.2
X-Trace: news2.kornet.net 1009775503 27193 211.57.49.2 (31 Dec 2001 05:11:43 GMT)
X-Complaints-To: usenet at news2.kornet.net
NNTP-Posting-Date: Mon, 31 Dec 2001 05:11:43 +0000 (UTC)
X-No-Archive: yes
X-Unac4ncel: yes
X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999)

This message was cancelled from within Mozilla.



More information about the Python-list mailing list