From: Philip J. <pj...@un...> - 2008-04-18 03:28:06
|
On Apr 17, 2008, at 12:07 AM, Samuele Pedroni wrote: > > wouldn't it make more sense for toString to correspond to __str__ > and to __repr__ only if the first is not defined, > notice that this would remove the need of special casing. Also I > think __str__ is really the conceptual correspondent > to toString, indeed both Python str.__str__ and java > String.toString are nops. I agree, I was trying to avoid too big of a change in behavior from what we had before. I guess most of our builtin types don't actually do anything special with __str__ and __repr__ -- those methods are typically doing the same thing, so what you're proposing wouldn't change much there. Our whole __str__/__repr__ setup is a little odd to me -- like for example PyObject's __repr__ is exposed as __str__. -- Philip Jenvey |