24.07.20 18:10, Gábor Bernát пише:
I would like to have a lazy repr evaluation for the objects! Sometimes users
have many really large objects, and when debugger is trying to show them in
Variables View (=show their string representation) it can takes a lot of time.
We do some tricks, but they not always work. It would be really-really cool to
have parameter in repr, which defines max number of symbols we want to evaluate
during repr for this object.
Maybe repr is not the best here, because that should be interpreter meaningful,
but instead the __str__ method that's better for this. Maybe we could pass in
an optional limit argument to these methods, so that the user can decide what
to print depending on how many characters he has left?
Any takes, better ideas how we could help this problem?
We need a structural repr protocol, which would represent complex object
as a structure containing items and attributes, so pprint() would know
how to format a multiline text representation, and graphic tools could
represent objects as a tree, with collapsed by default deep children and
long sequences which can be expanded interactively. It was discussed in
the past, but we still do not have good specification of such protocol.
_______________________________________________
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at
https://mail.python.org/archives/list/[email protected]/message/SDW6AHHOLJOTLEIWH7DUU5HNQRJ3U7UM/
Code of Conduct: http://python.org/psf/codeofconduct/