On 7/18/06, Greg Ewing <[EMAIL PROTECTED]> wrote: > I think that should be amended to "just use hasattr(obj. '__call__') > instead". That's what callable() will become equivalent to once > old_style classes are gone. > > Then it becomes a matter of whether it's worth having callable() > around as an alternative spelling. Those arguing in favour of > it would have to explain whether we should also have addable(), > subtractable(), mutiplyable(), indexable(), etc. etc. etc...
I think if the proponents of removing callable had made it more obvious that hasatr(obj, '__call__') was a relatively equivalent option which served to make it obvious what its limitations were, there would have been fewer objections. Then I personally find the intent indication of callable(obj) vs hasattr(obj, '__call__') to be a good trade. As for callable() vs addable(), etc., the reason is obvious. Function calls very commonly have large side effects and are only rarely idempotent. The operations you mention are expected to have no side effects on the object. This makes a try/except much more palatable for addition, subscripting, etc. than for calling a function. Michael -- Michael Urman http://www.tortall.net/mu/blog _______________________________________________ Python-3000 mailing list Python-3000@python.org http://mail.python.org/mailman/listinfo/python-3000 Unsubscribe: http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com