[New-bugs-announce] [issue39549] The reprlib.Repr type should permit the “fillvalue” to be set by the user
report at bugs.python.org
Mon Feb 3 20:07:30 EST 2020
New submission from Alexander Böhn <fish2000 at gmail.com>:
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.
components: Library (Lib)
title: The reprlib.Repr type should permit the “fillvalue” to be set by the user
versions: Python 2.7, Python 3.5, Python 3.6, Python 3.7, Python 3.8, Python 3.9
Python tracker <report at bugs.python.org>
More information about the New-bugs-announce