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.

Title: Unambiguous representation of recursive objects
Type: enhancement Stage: resolved
Components: Interpreter Core, Library (Lib) Versions: Python 3.6
Status: closed Resolution: rejected
Dependencies: Superseder:
Assigned To: Nosy List: Rosuav, fdrake, leewz, ncoghlan, rhettinger, serhiy.storchaka
Priority: normal Keywords: patch

Created on 2015-12-26 15:03 by serhiy.storchaka, last changed 2022-04-11 14:58 by admin. This issue is now closed.

File name Uploaded Description Edit
repr_recursive.patch serhiy.storchaka, 2015-12-26 15:03 review
Messages (4)
msg257037 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2015-12-26 15:03
For now repr() of recursive object replaces nested representations of self with a placeholder containing "...": "[...]" for list, "{...}" for dict, "set(...)" for set, and just "..." for Python classes that use reprlib. Unfortunately such replacements are valid expressions in Python 3.

The same replacement is used for too deeply nested objects in reprlib and pprint.

Proposed patch makes "<...>" to be always used as a placeholder. This is invalid syntax and well visually distinguishable.

Python-Ideas discussion:
msg257054 - (view) Author: Chris Angelico (Rosuav) * Date: 2015-12-26 22:53
LGTM. I'm currently seeing failures in test_ssl, but they weren't introduced by this patch. I'll run with this patch and see if I run into any third party test failures.

+1 on the change.
msg257168 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2015-12-29 06:44
Rejected by Guido.
msg257170 - (view) Author: Franklin? Lee (leewz) Date: 2015-12-29 07:18
Hey, I brought this up last month in the #python channel. I suggested `[ . . . ]`.

I agree that there's no great need, though.
Date User Action Args
2022-04-11 14:58:25adminsetgithub: 70144
2015-12-29 07:18:35leewzsetnosy: + leewz
messages: + msg257170
2015-12-29 06:44:04serhiy.storchakasetstatus: open -> closed
resolution: rejected
messages: + msg257168

stage: patch review -> resolved
2015-12-26 22:53:25Rosuavsetnosy: + Rosuav
messages: + msg257054
2015-12-26 15:03:56serhiy.storchakacreate