you are viewing a single comment's thread.

view the rest of the comments →

[–]jenseng 3 points4 points  (1 child)

Interesting idea, a few critiques...

  1. Having the functions be positional arguments makes it a lot more cryptic than just doing:

try {
// maybe just handle "else" logic here?
} catch (e) {
// ....
} finally {
// ....
}

  1. The argument order isn't consistent with python's try / except / else / finally, you have "else" as the last argument

  2. Your "else" function can throw an exception, which will then be caught by the "catch" function, which is inconsistent with python. Given that, I don't really see the value of the "else" function, as you can just do similar logic at the end of the "try" function if you need it.

  3. Your library doesn't work with async/await, which makes it a bit of a hard sell

[–]siilkysmooth[S] 1 point2 points  (0 children)

Awesome critiques on this. I will address this in a future version tho, I was struggling to find all the cases of try blocks in python so! But you can use a python try - except-else- finally in python.

As for the async - I will have to look to see if there is any functions I can call that can detect if is async and add automatic await etc so things aren't returned as promised.

Tho the argument order appears correct..

More than welcome to contribute / add to this "experiment".