From: Christopher B. <Chr...@no...> - 2007-12-14 19:24:16
|
Gael Varoquaux wrote: > Guys, I agree with all this. It's not about the theory, but about the > user experience. The user just types along, and doesn't read books and > manuals. A least the average user. And we want to make it as easy as > possible for her. Yes, we all like that. Which is why it was decided that __repr_ was the better default for display at the command line. See my example, too many questions along the lines of "python has a bug!" -- I'm guessing a very large fraction of those were about FP issues -- poorly understood my most newbies. I think it is clearly the best choice for things like a single floating point number, but for far more complex objects? who knows. As an example, look at the default behavior of numpy arrays: >>> a = numpy.ones((3,3)) >>> a array([[ 1., 1., 1.], [ 1., 1., 1.], [ 1., 1., 1.]]) Classic __repr__. but: >>> a = numpy.ones((1000,1000)) >>> a array([[ 1., 1., 1., ..., 1., 1., 1.], [ 1., 1., 1., ..., 1., 1., 1.], [ 1., 1., 1., ..., 1., 1., 1.], ..., [ 1., 1., 1., ..., 1., 1., 1.], [ 1., 1., 1., ..., 1., 1., 1.], [ 1., 1., 1., ..., 1., 1., 1.]]) no longer follows the __repr__ rules. I think that's an excellent choice -- it's really never useful to spew something that large to the screen. Given this discussion, what are you currently proposing? -Chris -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception Chr...@no... |