3 ms·
> Exception performance is terrible in almost every language. Duck-typing using exceptions is very idiomatic in Python. Also, raising an exception instead of r
by scardine 12y ago
> Exception performance is terrible in almost every language.
Duck-typing using exceptions is very idiomatic in Python. Also, raising an exception instead of returning error values is a popular API design. Hell, the iterator API - the foundation of loops in Python - raises an exception (StopIteration).
I guess this prescription about exceptions was made with some specific language in mind and it is dangerous to generalize.
- copsarebastards 12y agoYes, I do about 25% of my daily dev in Python and have done so for years, and I'm well aware that this is idiomatic in Python. Python was the specific language I was thinking of when I said "almost". > I guess this prescription about exceptions was made with some specific language in mind and it is dangerous to generalize. I guess this post about generalizing was made ignoring the word "almost" and it is dangerous to ignore qualifiers.
- scardine 12y agoI still think "almost any language" is a stretch, but I'm not in the mood of profiling several languages in order to assert this claim - without numbers my experience is as anecdotal as yours.