I have been reading http://www.python.org/dev/peps/pep-3100/ en there is written:
To be removed: ... callable(): just call the object and catch the exception ... But that doesn't seem to be a generally available option. The place where you want to check if something is callable doens't need to be the place where you actually want to call it. Removing callable will mean that you can't check whether or not something is callable without incurring the side-effects of calling it. I also think code will become more ugly How do you suggest I would code the following: if callable(func): for i, el in lst: lst[i] = func(el) othercode() I can code as follows: try: for i, el in lst: lst[i] = func(el) othercode() except TypeError: pass But this has the problem that othercode could throw a TypeError: So it seems I would need at least two try statements try: for i, el in lst: try: lst[i] = func(el) except TypeError raise LoopBreak othercode() except LoopBreak: pass And this still has problems because the TypeError could be raised because lst is an unsubscriptable object. Is there a chance this will be reconsidered? -- Antoon Pardon -- http://mail.python.org/mailman/listinfo/python-list