On 11/17/06, Greg Ewing <[EMAIL PROTECTED]> wrote: > Bill Janssen wrote: > > Checking for some textual attributes of a > > type > > Now you're talking about LYBL, which is generally > considered an anti-pattern in Python. APIs should > be designed so that you don't need to test for the > presence of features.
The end user may not have to explicitly test for it, but it happens anyway behind the scenes; x.foo is functionally equivalent to if hasattr(x,'foo'): return getattr(x,'foo') else: raise AttributeError() I think Bill's point is not whether you have to be explicit about it or the language does it for you, but that the textual check must happen at some point, and that this is inherently unsafer than a semantic check. George _______________________________________________ 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