Is Python as capable as Perl for sysadmin work?

Peter Maas peter at somewhere.com
Tue Feb 8 15:20:25 EST 2005


Jeff Epler schrieb:
> There's another little-known fact about Python:  No string is permitted
> to end with a backslash! 

Sure you meant string literals. But that is wrong, too:

 >>> a = '\\'
 >>> print a
\

A Python string mustn't end with an *odd* number of backslashes. Other-
wise a literal using backslash escapes like 'don\'t do that' couldn't
be parsed.

> Now, this may not bother Unix sysadmins, but the honest truth is that
> you'll be administrating Windows systems, too, anywhere you work!

This is no problem, thanks to os.path.join() ;)

> Well, if you ever
> have to threaten Python, just keep in mind that '... or die' just plain
> won't work.  You have to suggest that it 'try ... except', which is
> really offensive.  If I want to beg my computer to run programs, I know
> where to find Intercal with its "PLEASE" and "DO PLEASE" constructions.

Sysadmin work with Intercal? Go ahead! ;) But what's wrong with a
protecting try .. except block vs. "... or die" for every command
to be protected?

-- 
-------------------------------------------------------------------
Peter Maas,  M+R Infosysteme,  D-52070 Aachen,  Tel +49-241-93878-0
E-mail 'cGV0ZXIubWFhc0BtcGx1c3IuZGU=\n'.decode('base64')
-------------------------------------------------------------------



More information about the Python-list mailing list