In school this week, the idea of finding palindromes in Python came up, as a homework assignment in a class I took last semester. A friend asked me for some guidance in how to do this in Python, so I showed him my "simple" solution:

```#!/usr/bin/env python
import operator
import string
import sys

words = " ".join(sys.argv[1:]) if len(sys.argv) > 1 else sys.argv

result = reduce(lambda x, y: x and y, map(lambda x, y: x == y, *map(lambda x: (x[:len(x)/2], x[:(len(x) - 1) / 2:-1]), (reduce(operator.add, map(lambda x: x if x.isalpha() else "", words)),))))

print(words)
print(result)
```

See, it's only a single line.. and so clear too.

If you happen to be one of those crazy people who uses functions besides map and reduce, it could be shortened to this:

```#!/usr/bin/env python
import operator
import string
import sys

words = " ".join(sys.argv[1:]) if len(sys.argv) > 1 else sys.argv

result = all(map(operator.eq, *map(lambda x: (x[:len(x)/2], x[:(len(x) - 1) / 2:-1]), ("".join(filter(str.isalpha, words)),))))

print(words)
print(result)
```

Of course, there's also the super-lame solution, which doesn't use map or reduce at all (this is the version I actually turned in last semester):

```#!/usr/bin/env python
# Note: This program works in Python 2.7 and Python 3.1
#       (and possibly other versions)
# Brendan Long
try:
# Python 2 - zip returns a list, izip returns a generator
from itertools import izip as zip
except ImportError:
# Python 3 - zip returns a generator, no need to change
pass
import sys

def pal(in_string):
""""
check whether in_string is a palindrome
return True if so, False otherwise
"""

# Take the first half of the string and the second half
# reversed.
# If the string has odd length, we just drop the middle
# character because it doesn't matter.
forward        = in_string[:len(in_string)//2]
backward = in_string[:(len(in_string) - 1)//2:-1]

# If the beginning iterator and ending iterator always match
# up, the string is a palendrome.
return all((begin == end
for begin, end
in zip(forward, backward)))

def clean(in_string):
"""
remove non letters from in_string
turn uppercase letters into lower case
return result
"""
return ''.join(filter(str.isalpha, in_string)).lower()

if __name__ == "__main__":
# read arguments from command line
input = " ".join(sys.argv[1:])
print("%s: %s" % (input, pal(clean(input))))
```