News for hackers. Stuff that matters.
Re:The Non-Programming Programmer by Luyt on Monday February 22, 2010 @02:08PM (#1143443)

  python -c "print '\n'.join(open('file.txt').readlines()[::-1])"
Hmmm, slightly longer then the Perl version ;-)

  python -c "print '\n'.join(reversed(list(open('test.py'))))"
Somewhat more elegant, but still lots of parentheses.
Re:The Non-Programming Programmer by RiderOfGiraffes on Monday February 22, 2010 @02:36PM (#1143506)
It's also wrong - "readlines" keeps the "\n", and you've added another one between lines.
Re:The Non-Programming Programmer by Luyt on Monday February 22, 2010 @04:38PM (#1143799)
Indeed. A cosmetic refinement, but it should really be:

  python -c "print ''.join(reversed(list(open('test.py'))))"
That's even two characters less!
Re:The Non-Programming Programmer by spudlyo on Monday February 22, 2010 @06:36PM (#1144086)
Good, but too easy. Assume you can't keep the file in memory.