4 ms·
Exciting release. All useful additions. Love the Variadic Generics (embed array layout into its type top avoid confusion). A surprisingly common issue in data s
by prennert 4y ago
Exciting release. All useful additions. Love the Variadic Generics (embed array layout into its type top avoid confusion). A surprisingly common issue in data science code.
But.. I am I the only one who struggles to parse the Exception groups?
*ValueError: ExceptionGroup('eg', [ValueError(1), ExceptionGroup('nested', [ValueError(6)])])
*OSError: ExceptionGroup('eg', [OSError(3), ExceptionGroup('nested', [OSError(4)])])
| ExceptionGroup: (2 sub-exceptions)
+-+---------------- 1 ----------------
| Exception Group Traceback (most recent call last):
| File "<stdin>", line 15, in <module>
| File "<stdin>", line 2, in <module>
| ExceptionGroup: eg (2 sub-exceptions)
+-+---------------- 1 ----------------
| ValueError: 1
+---------------- 2 ----------------
| ExceptionGroup: nested (1 sub-exception)
+-+---------------- 1 ----------------
| ValueError: 6
+------------------------------------
+---------------- 2 ----------------
| Exception Group Traceback (most recent call last):
| File "<stdin>", line 2, in <module>
| ExceptionGroup: eg (3 sub-exceptions)
+-+---------------- 1 ----------------
| TypeError: 2
+---------------- 2 ----------------
| OSError: 3
+---------------- 3 ----------------
| ExceptionGroup: nested (2 sub-exceptions)
+-+---------------- 1 ----------------
| OSError: 4
+---------------- 2 ----------------
| TypeError: 5
+------------------------------------
Would it not have been better to left or right align the exception group id? Centering them just clobbers them with the actual error output and makes it a bit hard to parse.
- joenot443 4y agoI've written Python for a long time now but I still had a very difficult time grokking the Exception groups format. Maybe it'd look better in the terminal, but to me it feels like the table formatting makes it HARDER to understand.
- quietbritishjim 4y agoThat output looks super complicated, but if you get an error like that then I think you're in a super complicated situation to start with: you've started a hierarchy of tasks, of which 6 raised exceptions (only counting leaf-node exceptions) at 4 different levels of the hierarchy. I could believe that left aligning the exception group index could've made it a little simpler though.
- sva_ 4y agoIf you're noticing that the numbers that form a list are right below each other in the same column, it kind of makes sense. Suddenly it seems a lot more ordered. Could be done differently though. Left alignment seems clearer: *ValueError: ExceptionGroup('eg', [ValueError(1), ExceptionGroup('nested', [ValueError(6)])]) *OSError: ExceptionGroup('eg', [OSError(3), ExceptionGroup('nested', [OSError(4)])]) | ExceptionGroup: (2 sub-exceptions) +-+- 1 ------------------------------- | Exception Group Traceback (most recent call last): | File "<stdin>", line 15, in <module> | File "<stdin>", line 2, in <module> | ExceptionGroup: eg (2 sub-exceptions) +-+- 1 ------------------------------- | ValueError: 1 +- 2 ------------------------------- | ExceptionGroup: nested (1 sub-exception) +-+- 1 ------------------------------- | ValueError: 6 +------------------------------------ +- 2 ------------------------------- | Exception Group Traceback (most recent call last): | File "<stdin>", line 2, in <module> | ExceptionGroup: eg (3 sub-exceptions) +-+- 1 ------------------------------- | TypeError: 2 +- 2 ------------------------------- | OSError: 3 +- 3 ------------------------------- | ExceptionGroup: nested (2 sub-exceptions) +-+- 1 ------------------------------- | OSError: 4 +- 2 ------------------------------- | TypeError: 5 +------------------------------------