Merits of replacing bash with python

Cameron Laird claird at starbase.neosoft.com
Mon May 20 08:31:03 EDT 2002


In article <m3lmaf7wjn.fsf at mira.informatik.hu-berlin.de>,
Martin v. Loewis <martin at v.loewis.de> wrote:
>"Kevin Davies" <davies at jkevin.freeserve.co.uk> writes:
>
>> I am pretty new to python and am looking for some good reasons to
>> replace bash with python.
>>  
>> I can see already that python is pretty much executable pseudocode and
>> is OO.
>>  
>> Can anyone give further insight?
>
>For writing scripts, I'd give the following reasons why writing Python
>is better than writing bash:
>
>- more stuff is built-in; you don't need to create new processes
>- execution of Python code is faster than bash's interpretation
>- Python gives better error messages in case of problems
>- Python exposes system functionality that might not be available
>  as a utility (e.g. newgrp to a numeric group)
>- Python exposes additional libraries not available in shell (sockets,
>  GUIs, dbm, etc)
>
>For interactive use, I would not recommend to replace bash (except,
>perhaps, with zsh :-)
			.
			.
			.
Also, Python's a better language.

That sounds inflammatory, although it's not my intent.
I'm always among those urging folks to consider that
languages are more *different* than better/worse.  A
comparison of Python and bash is reasonably straight-
forward, though.  Python's simultaneously more regular
(easy, simple), more powerful, and more portable
(which I shan't insist is a "language" issue, if
someone wants to fuss). That's a winning combination.

I still use bash for some things.  I don't think
there's much use in newcomers learning it, though.

Sockets *are* available to the newer *sh-s, by the
way.  Some of them also bind to Tk for GUI capa-
bilities.  Polish is less than for Python.
-- 

Cameron Laird <Cameron at Lairds.com>
Business:  http://www.Phaseit.net
Personal:  http://starbase.neosoft.com/~claird/home.html



More information about the Python-list mailing list