euglug.org

[Python] [sechrest@peak.org: [lug] Perl vs Python vs Ruby Bake off]

작성자

카테고리:



Bob MillerMon May 17 16:37:00 PDT 2004

I foolishly allowed myself to be the Python advocate in this contest
(see below).  I could use some help in coming up with the Python
example problem.

I don't know Ruby (and don't plan to learn anytime soon), so I'm
thinking about things Python does better than Perl 5.

I think Python's real strengths are in readability and
maintainability, which won't come out in this contest.  But I think
there are a few ways that "Python in the small" will outshine Perl,
too.

Things that come to mind: classes are much more lightweight, built-in
classes are easily extended, ability to overload operators, the
sequence/iterator paradigm, metaclass semantics (but I don't really
understand metaclasses)...

Overload operators.  Maybe I could build a vector math package with
well-integrated syntax.  Can you do that in Perl?

	Vector v1 = (1, 2, 3), v2 = (4, 5, 6+5j)
	Scalar s = 3.14
	print (s * (v1 + v2) / v2).dot(v1)

The same code would work with vectors of ints, bignums, floats,
complex and bools as well as user-defined numeric types such as
quaternions or matrices.  Just an idea, I'm not really a math guy.

Sequence/iterator.  Any Python object with sequence semantics
(including generators) can be the subject of a for loop.
Perl restricts you to the list built-in, though you can
do this in Perl.

	while (my $x = generator) {
	    # ...
        }

Maybe something on Chris's just for fun page would be significantly
harder in Perl?  (I haven't looked at that page lately.)

Anyway, please help!

----- Forwarded message from John Sechrest <sechrest at peak.org> -----

From: John Sechrest <sechrest at peak.org>
Date: Sat, 15 May 2004 13:02:46 -0700
Subject: [lug] Perl vs Python vs Ruby Bake off
To: lug at peak.org

Hello,


	I would like to hold a Perl vs Python vs Ruby bake-off.
	A contest between perl programmers, ruby programmers and
	python programers.
	
	I want to find 3 example problems which cause 
	something in one language to shine, but that are 
	hard in the other two.

	This is your chance.

	Please take a moment and see if you can come up with
	a good example program, that given 1 week of thinking
	about it, a programer could come up with a solution
	in a short amount of time (2-3 hours)

	What kind of problem would perl be good at that python would
	not? 

	Why should I use ruby when I can code in perl? 

	Give me an example problem that shows that your favorite language
	is really the best...

	Please post them to the list, we will be having a discussion
	for the next few weeks, until we can come up with a
	good set to pick from.

	The decision to hold this conversation on the mail list
	was made at the last meeting. So please step up to the 
	task and see if we can really generate some great examples.



	





http://www.mjtsai.com/blog/archives/2002/11/25/perl_vs_python_vs_ruby.html
http://www.ruby-lang.org/en/compar.html

http://www.infocopter.com/perl/perl-vs-python.htm
http://www.vex.net/~marc/resources/ruby-perl-python.shtml
http://c2.com/cgi/wiki?PythonVsRuby
http://www.rubycentral.com/faq/rubyfaq-2.html
http://www.vendian.org/mncharity/dir3/multilang/file/
http://freshmeat.net/articles/view/334/
http://use.perl.org/comments.pl?sid=10662&cid=16021
http://www.iolanguage.com/FAQ.html
http://www.cse.unsw.edu.au/~gregm/rubylecture/ruby.pdf
http://en.wikipedia.org/wiki/Ruby_programming_language
http://www.radwin.org/jeske/2003/08/the_one_true_reason_to_use_pytho.html

http://www.linuxjournal.com/article.php?sid=3882
http://www.manicwave.com/blog/archives/000037.html
http://freshmeat.net/articles/view/433/
http://www.infoworld.com/article/03/03/21/12stratdev_1.html
http://weblog.infoworld.com/udell/2003/03/21.html


http://www.sidhe.org/~dan/blog/archives/000151.html
http://lwn.net/2001/features/LarryWall/



--
John Sechrest          .         Helping people use
                        .           computers and the Internet
                          .            more effectively
                            .                      
                               .       Internet: sechrest at peak.org
                                    .        
                                            . http://www.peak.org/~sechrest
								   

----- End forwarded message -----

-- 
Bob Miller                              K<bob>
kbobsoft software consulting
http://kbobsoft.com                     kbob at jogger-egg.com