PR #3841 in devel: two great new tracing functions

14 views
Skip to first unread message

Edward K. Ream

unread,
Mar 25, 2024, 10:20:06 AM3/25/24
to leo-editor

PR #3841 (now in Leo's "devel" branch) adds two spectacularly useful tracing functions: g.traceUnique and g.traceUniqueClass


Both functions take one value argument (which can be of any type) and one keyword-only n argument that defaults to 2.


g.traceUnique(value) prints caller/value pairs:


    f"{g.callers(n):30} {str(value)}"


but only once for each unique combination of g.callers(n) and str(value).


g.traceUniqueClass(value) prints caller/class-name pairs:


    f"{g.callers(n):30} {value.__class__.__name__}"


Again, just once for each caller/class-name pair.


Summary


g.traceUniqueClass is perfect for discovering the proper annotation for any argument!


How did I ever live without these new functions?


Edward

Reply all
Reply to author
Forward
0 new messages