On Tue, Aug 24, 2010 at 4:51 AM, Steven D'Aprano <steve at pearwood.info> wrote: > But that's the thing... as far as I am concerned, a dynamically defined > attribute *doesn't* exist. If it existed, __getattr__ would never be > called. A minor semantic difference, to be sure, but it's real to me. Eh? If "x.y" succeeds, in what sense does y not exist? > Whether I should care about the difference is a separate issue. Right, you are breaking through too much abstraction. > Performance could be an issue, of course, if somebody writes an > expensive __getattr__ or property. Computed attributes should be cheap. Yes, and it should be considered the problem of the author of that property, not of the user. > But I'm actually more concerned about side-effects than performance. Properties should not have side effects. That would be a problem when using them just as much as with hasattr(). -- --Guido van Rossum (python.org/~guido)
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4