M
Modular12mo ago
rdickert

Errors for flow control?

Exceptions are used for flow control in Python (e.g. the StopIteration exception). Is this considered a good/normal practice in mojo as well (using Error I guess)?
2 Replies
guidorice
guidorice12mo ago
Mojo doesn't even have classes yet so, it's not the same as python's class exception hierarchy. But we do have try/except blocks, for control flow. Somewhere I read that mojo Error is much more lightweight than Python exceptions because it does not include a whole stack unwinding/tracing deal. Sorry I cannot find where I read that!
Want results from more Discord servers?
Add your server