From: Daniel Berger Date: 2006-03-04T07:54:51+09:00 Subject: Re: Python for Ruby programmers Joe Van Dyk wrote: > On 3/3/06, Joe Van Dyk wrote: > > Hi, > > > > I need to write a GUI for a vanilla RHEL3 box (with no extra software > > installed on it). I figure Python / pygtk2 is a good choice for this, > > as it's installed by default. (Ruby is 1.6.8 on that box, and > > ruby-gnome2 isn't installed). The GUI will do various RPM-related > > things -- it's a program that will examine a machine's configuration > > and figure out what additional RPMs need to be installed before a user > > can run our software. > > > > I don't know much python, although I did write a small program in it a > > few years ago. Any pointers on where I could get a quick introduction > > to it? I don't need an introduction to programming, I need an > > introduction to Python (and preferably from a Rubyist POV). > > What's the Ruby equivalent of this? > > for f in filter(lambda f: f(-1)>=f(1), > [lambda x:x, lambda x:x**2, lambda x:x**3]): > for x in range(-10, 11): > print x, f(x) > -10.upto(10){ |n| puts "#{n} #{n**2}" } >:) Dan