On 4/6/06, John J Lee <[EMAIL PROTECTED]> wrote: [suggests changing the docs for repr for Py3k]
The current help(repr) may be even more misleading. I would suggest making the change as early as 2.4 (2.5 for the docstring. Changes: (1) It doesn't mention backquotes. They are already deprecated, so it makes sense to mention the equivalency in the backquote docs, rather than the repr docs. (2) Saying "for debugging" instead of "canonical" makes it less of an attractive nuisance. (canonical can mean "the one right way") (3) Giving the < > example along with -- or even before -- the eval makes it clear that you shouldn't rely on the eval loop in the general case. These are good changes, even from a 2.x perspective. As to the exact wording -- what are the current guarantees on the type of repr's return. Can it be unicode? If we don't want to explicitly ban unicode, I would modify your suggestion (even today) to """repr(object) -> string Return a printable representation of an object, useful for debugging. For simple objects, repr may the inverse of eval, so that eval(repr(obj)) == obj. More complex objects typically use '<...useful info ...>' such as '<__main__.C instance at 0x00B818C8>'. """ -jJ _______________________________________________ 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