[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [OT] inline python (was Re: [ in /usr/bin Question)



On Thu, May 10, 2007 at 05:52:03PM +0100, william pursell wrote:
> Bob McGowan wrote:
> >So, a question:  Can python 'run' code directly from the command line, 
> >as Perl does with the -e option?
> Yes:
> 
> python -c 'print "!dlrow olleH"[::-1]'

Nice example of how python, besides being capable of one-liners, isn't
a cryptic language! ;-)

I had no idea what the above collection of characters would do, though in
retrospect I should have figured it out.  Perl is famous for obfuscation
contests, but it can also be pretty clear (as, I'm sure, can Python
be), e.g.,

  $ perl -e 'print reverse(split(//,"!dlrow olleH")), "\n"'

But where's the fun in that?

It's tiring to hear, repeatedly, how much better MY language is than YOUR
language.   Once one learns any given language it's perfectly obvious to
the writer, and to any reader also familiar with it, what a given piece
of code does.  To say that MY language is intrinsically superior to
YOURS because it is not cryptic is, well, a comfortable belief, I suppose.

Ken

-- 
Ken Irving



Reply to: