Skip to content

Ease initialization of reprlib.Repr attributes #94343

Closed
@finefoot

Description

@finefoot

If you want to use the reprlib.Repr class, currently, you need to instantiate an object and then set the desired attributes, afterwards, before you can actually use it:

from reprlib import Repr myrepr = Repr() myrepr.maxlevel = 10 myrepr.maxlist = 3 myrepr.maxdict = 1 myrepr.repr(myobject)

It might be more comfortable and clearer sometimes, to be able to set the attributes during the initialization:

from reprlib import Repr myrepr = Repr(maxlevel=10, maxlist=3, maxdict=1) myrepr.repr(myobject)

Furthermore, this would make it possible to use reprlib.Repr without having to designate a permanent name:

from reprlib import Repr Repr(maxlevel=10, maxlist=3, maxdict=1).repr(myobject)

Metadata

Metadata

Assignees

No one assigned

    Labels

    type-featureA feature request or enhancement

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions