perl to python

David M. Cooke cookedm+news at physics.mcmaster.ca
Wed May 12 11:42:24 EDT 2004


At some point, Daniel 'Dang' Griffith <noemail at noemail4u.com> wrote:

> On 11 May 2004 12:05:52 GMT, Oliver Fromme <olli at haluter.fromme.com>
> wrote:
>
>>Daniel 'Dang' Griffith <noemail at noemail4u.com> wrote:
>> > [on sed]  One reason
>> > to install it is that it's smaller than perl or python; another is
>> > that it probably performs the task faster, since it isn't a general
>> > purpose state machine;
>>
>>FWIW, sed _is_ a state machine, although not really "general
>>purpose".  It is a programming language with variables, loops
>>and conditionals, and I believe it is turing-complete.  Most
>>of the time it is abused to perform simple search-and-replace
>>tasks, though.  ;-)
>
> I never used sed for anything but "stream editing", aka search and
> replace.  Well, if it's turing complete, my apologies to the sed
> author(s).  :-)
>     --dang

There's a whole bunch of 'extreme' sed scripts at
http://sed.sourceforge.net/grabbag/scripts/

I like the dc.sed script there; it's an implementation of the UNIX
program 'dc', which is an arbitrary precision RPN calculator:
http://sed.sourceforge.net/grabbag/scripts/dc_overview.htm
Only for the truly brave.

A Turing machine, too:
http://sed.sourceforge.net/grabbag/scripts/turing.sed

And I notice they have a Python sed debugger:
http://sed.sourceforge.net/grabbag/scripts/sd.py.txt

-- 
|>|\/|<
/--------------------------------------------------------------------------\
|David M. Cooke
|cookedm(at)physics(dot)mcmaster(dot)ca



More information about the Python-list mailing list