Skip to content

Instantly share code, notes, and snippets.

@razimantv
Last active March 30, 2024 08:03
Show Gist options
  • Select an option

  • Save razimantv/1b33d4a090a5bc9ed94928012b37c3f0 to your computer and use it in GitHub Desktop.

Select an option

Save razimantv/1b33d4a090a5bc9ed94928012b37c3f0 to your computer and use it in GitHub Desktop.
Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@gauthamzz

Copy link
Copy Markdown

👍

@a-huy

a-huy commented Feb 27, 2018

Copy link
Copy Markdown

You might want to define a custom Exception class for this - it looks like the current implementation will confuse KeyboardInterrupt and unrelated functional exceptions as an attempt to recurse.

@progval

progval commented Feb 28, 2018

Copy link
Copy Markdown

Next step: tail-recursion optimization

@petiepooo

Copy link
Copy Markdown

Cool hack, but a-huy is right: a naked except clause? Tsk tsk..

@tchoutri

Copy link
Copy Markdown

Can't wait for proper recursion now!

@float64co

Copy link
Copy Markdown

👍

@Aristarhys

Copy link
Copy Markdown

🤘

@jasen-b

jasen-b commented Feb 28, 2018

Copy link
Copy Markdown

a custom exception is not needed, the exception problem can be fixed by reducing the scope of the try block and using some messy branching or a tidy little goto.

@skliarpawlo

Copy link
Copy Markdown

I think you can pass __next_arg via exception params instead of stackify object state.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment