Éric Araujo <mer...@netwok.org> added the comment:

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.

----------
nosy: +eric.araujo

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue868845>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to