UserLinux chooses Python as "interpretive language" of choice

John Roth newsgroups at
Sat Dec 20 14:44:45 CET 2003

"Oren Tirosh" <oren-py-l at> wrote in message
news:mailman.370.1071922543.9307.python-list at
> On Fri, Dec 19, 2003 at 07:29:57PM -0500, John Roth wrote:
> > "Ville Vainio" <ville.spammehardvainio at> wrote in message
> > news:du7ekv0z7g3.fsf at
> > > I don't know if you have seen this before, but here goes:
> > >
> > >
> > >
> > > There is a jab at Python, though, mentioning that Ruby is more
> > > "refined".
> >
> > I'm not sure about refined, but it does seem to have several
> > things that I think I'd like. One is a much
> > better way of handling anonymous functions, aka "blocks."
> > Another is the pervasive use of the visitor pattern, and
> I've always considered the visitor pattern as a rather poor substitute
> for generators, not as a something worth having for its own sake. Using
> generators instead of visitors+anonymous functions obviously reduces the
> need for anonymous functions (not that it's any excuse for not having
> something better than Python's lambdas!).

I'm not certain I'm making the connection. The visitor pattern
as I use it doesn't seem to have much to do with generators.
It's a way of disconnecting the sequencing logic from the
processing logic, while a generator seems to encapsulate
both in the same function.

A good case in point is file processing. I've got a class that
encapsulates a directory: instantiate it and it reads the directory
into an internal list. Then if you invoke the .visit(instance)) method,
it calls either the 'file' or the 'directory' method in that instance
for each of the names in the directory. If I need to go down a
directory chain, I simply invoke it recursively.

If I arranged it so I called the visitor instance one last time
(possibly using a 'lastTime' method) I could completely
replace the reduce built-in for any object that had a .visit

Blocks plus the pervasive availibility of a .visit() method is the
overwhelmingly most common thing Ruby users mention for
why they like the language. It seems to be somewhat of a
paradigm shift.

John Roth
>     Oren

More information about the Python-list mailing list