[EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > just curious, how can this identity function be used ? In haskell, > because all functions are curried, I can sort of visualize/understand > how id is used. Not quite understand how it can be used in python.
There was a very recent example posted to this group (by Robin Becker, I believe, looking for ways to "override property"), something like: def __init__(self, validate=None): if not validate: validate = lambda x: x self.validate = validate and later on, self.validate is always unconditionally called to extract a valid value from an input argument to another method -- a nicer style, arguably, than assigning self.validate unconditionally and then having to test each and every time in the other method. Such subcases of the well-known "Null Object" design pattern, where you don't want to store None to mean "no such object" but, to avoid repeated testing, rather want to store an object which "reliably does nothing", are reasonably common. In an abstract way, they're somewhat akin to having the 'pass' statement in the language itself;-). Alex -- http://mail.python.org/mailman/listinfo/python-list