[Michael Hudson] > I wonder if dir() should strip non-strings? -0 The behavior of dir() already a bit magical. Python is much simpler to comprehend if we have direct relationships like dir() and vars() corresponding as closely as possible to the object's dictionary. If someone injects non-strings into an attribute dictionary, why should dir() hide that fact?
Likewise, we would have been better-off if ceval.c didn't pre-process data before handing it off to API functions (so that negative indices get handled the same way in operator module functions and in user defined methods, etc). Both Io and Lua have made a design principle out of keeping these relationships as direct as possible (i.e. a[b] always corresponds to the call a.__getitem__(b) with no intervening magic, etc.). <begin side-topic-rant> The auto-exposure on my camera takes in nine data points and guesses whether the subject is backlit, whether there is a mix of light and dark, whether it is more important avoid blown highlights or to miss shadow detail, etc. The good news is that it often makes a decent guess. The bad news is that I've completely lost the ability to predict whether I've gotten a good shot based on the light conditions and camera settings. IOW, if you make the tools too smart, they become harder to use. Leica had it right all along. <end side-topic-rant> Raymond _______________________________________________ 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