Guido van Rossum wrote: > Um, that does't work for types which customize __getattribute__ or > __getattr__ in various ways.
There could be a __hasattr__ slot in the class itself for that purpose. > IMO a property that has a side effect (other than updating a cache or > statistics or perhaps logging) is a misfeature anyway, Even if it doesn't have side effects, getting the attribute's value could be expensive. One shouldn't have to pay the full cost of getting the value just to find out whether the attribute itself exists. To put it another way, hasattr is enquiring about the object's interface, not asking it to perform a computation. Doing the latter when only being asked to do the former is wrong, IMO. Greg _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com