This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author eric.araujo
Recipients belopolsky, eric.araujo, georg.brandl, gvanrossum, ncoghlan, petri.lehtinen, terry.reedy
Date 2011-10-18.15:45:15
SpamBayes Score 6.359473e-07
Marked as misclassified No
Message-id <1318952716.72.0.610759532243.issue868845@psf.upfronthosting.co.za>
In-reply-to
Content
Original report:
> Samuele Pedroni points out in python-dev that the <...> style reprs of Python objects are
> not documented, standardized or even consistent (e.g. compare old-style and new-style
> classes).
>
> Yet there is plenty of code out there that for various reasons parses these things or a
> least depends on what they look like (the parrot benchmark being only the latest example).

<...>-style reprs have been documented by Georg; for the consistency part, I just run the snippet from Nick on 3.2:

<class 'array.array'>
<class 'dict'>
<class '__main__.foo'>
<__main__.foo object at 0x13fa810>
<function x at 0x1399050>
<bound method foo.x of <__main__.foo object at 0x13fa850>>
<function func at 0x132cf30>

I would call that consistent.  (FWIW I like that the dict repr contains “dict” and not “builtins.dict”, as the common form for using it does not need the module part.)

For the standardization part, Alexander proposed this:
> For 3.0, I think it is feasible to standardize on the
> <{type} object ['{name}'] ... at 0x{addr}> pattern.

If there are tools out there that parse reprs, I think a change that would break them should have been in 3.0, now we’re bound by b/w compat.

To sum up: <...>-style reprs are documented and consistent enough, so let’s close this.
History
Date User Action Args
2011-10-18 15:45:16eric.araujosetrecipients: + eric.araujo, gvanrossum, georg.brandl, terry.reedy, ncoghlan, belopolsky, petri.lehtinen
2011-10-18 15:45:16eric.araujosetmessageid: <1318952716.72.0.610759532243.issue868845@psf.upfronthosting.co.za>
2011-10-18 15:45:16eric.araujolinkissue868845 messages
2011-10-18 15:45:15eric.araujocreate