On Wed, 07 Sep 2005 00:02:49 GMT
Chris Dutton wrote:
I'm just curious. I've been trying to demonstrate functional thinking
in Python, but I can't find these methods for int objects. It would be
immensely helpful for something like:
filter(4 .__lt__, range(10))
As opposed to:
filter(lambda a: 4 < a, range(10))
Python is neither pure object nor pure functional language. There is an
"operator" module, with its operator.lt, but it is not exactly what you need.
You still need lambda with it.
The recommended way to do what you want is
result = [x for x in xrange(10) if 4 < x]
--
jk