Closed
Description
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)