[Roose] > I like this, it is short, low impact, and makes things more readable. I > tend to go with just the literal way of doing it instead of using get and > setdefault, which I find awkward.
Thanks. Many people find setdefault() to be an oddball. > But alas I had a my short, low impact, useful suggestion and I think it > died. It was for any() and all() for lists. Actually Google just released > their "functional.py" module on code.google.com with the exact same thing. > Except they are missing the identity as a default which is very useful, i.e. > any(lst, f=lambda x: x) instead of any(lst, f). > > Maybe you can tack that onto your PEP :) Py2.5 is already going to include any() and all() as builtins. The signature does not include a function, identity or otherwise. Instead, the caller can write a listcomp or genexp that evaluates to True or False: any(x >= 42 for x in data) If you wanted an identify function, that simplifies to just: any(data) Raymond Hettinger -- http://mail.python.org/mailman/listinfo/python-list