[OT] range() for unix shell

Paul Winkler bass at slinkp.com
Thu Mar 7 20:34:53 EST 2002


Skip Montanaro <skip at pobox.com> wrote in message news:<mailman.1015542375.17702.python-list at python.org>...
> Paul> Today, struck by the similarity between sh and python's for loops,
>     Paul> and facing an example which required us to generate a range of
>     Paul> numbers from boundary parameters, I wrote a sh range function. It
>     Paul> works just like python's range() function (allowing for syntactic
>     Paul> differences).
> 
> Why stoop to sh?  Here's a range command I've used for years written in
> Python. ;-)

(snip)

Well, of course, that's the quickest way to do it if you know you'll always
have python. Which is likely to be true EXCEPT when booting from an emergency
floppy... precisely the time I seem to need the largest number of handy little
tools...

And as Neil pointed out, GNU seq does pretty much the same thing
(with a totally different interface). Good to know about that one.
But again, I'm not likely to use 16k of rescue floppy space for seq.

Thanks for the comments...

--PW



More information about the Python-list mailing list