classification
Title: The reprlib.Repr type should permit the “fillvalue” to be set by the user
Type: behavior Stage: patch review
Components: Library (Lib), Tests Versions: Python 3.9
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: fish2000, rhettinger
Priority: normal Keywords: patch

Created on 2020-02-04 01:07 by fish2000, last changed 2020-02-06 12:03 by cheryl.sabella.

Pull Requests
URL Status Linked Edit
PR 18343 open fish2000, 2020-02-04 02:16
Messages (1)
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.
History
Date User Action Args
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