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: The reprlib.Repr type should permit the “fillvalue” to be set by the user
Type: behavior Stage: resolved
Components: Library (Lib), Tests Versions: Python 3.9
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: rhettinger Nosy List: fish2000, rhettinger
Priority: normal Keywords: patch

Created on 2020-02-04 01:07 by fish2000, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 18343 merged fish2000, 2020-02-04 02:16
Messages (2)
msg361334 - (view) Author: Alexander Böhn (fish2000) * Date: 2020-02-04 01:07
Currently, the `reprlib.recursive_repr(…)` decorator allows a “fillvalue” parameter to be specified by the user. This is a string value that is used as a placeholder when calculating an objects’ repr – in the case of `recursive_repr(…)` the “fillvalue” defaults to '...' and may be set by the user to a string of any length.

There is no such user-defined “fillvalue” on the `reprlib.Repr` type, although the '...' string is hardcoded in its implementation and used throughout.

I propose that the hardcoded use of the '...' string in the code for the `reprlib.Repr` implementation should be replaced by a “fillvalue” attribute, set on the class in its `__init__(…)` method – and therefore overridable in subclasses, like the existing myriad “max*” instance attributes. 

PR to follow in short order.
msg402471 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2021-09-22 20:46
New changeset 8c21941ddafdf4925170f9cea22e2382dd3b0184 by Alexander Böhn in branch 'main':
bpo-39549: reprlib.Repr uses a “fillvalue” attribute (GH-18343)
Date User Action Args
2022-04-11 14:59:26adminsetgithub: 83730
2021-09-22 20:46:31rhettingersetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2021-09-22 20:46:07rhettingersetmessages: + msg402471
2021-09-19 18:47:58rhettingersetassignee: rhettinger
2020-02-06 12:03:30cheryl.sabellasetnosy: + rhettinger

versions: - Python 2.7, Python 3.5, Python 3.6, Python 3.7, Python 3.8
2020-02-04 10:08:00fish2000setcomponents: + Tests
2020-02-04 02:16:25fish2000setkeywords: + patch
stage: patch review
pull_requests: + pull_request17716
2020-02-04 01:07:30fish2000create