Y
Hacker News
new
|
ask
|
show
|
jobs
by
paul-woolcock
5049 days ago
That strikes me as very Pythonic attitude. If you're going to fail, fail early. But, I know Python way better than Ruby, so it might very well be a Ruby thing too.
3 comments
aneisf
5049 days ago
I'm not sure if it's Pythonic as I've never written Python. It's a habit I carried over from the .NET world, actually.
link
mgurlitz
5049 days ago
Wouldn't the Pythonic thing be to only fail after you've tried, instead of validating your parameters in advance?
link
agentultra
5049 days ago
Yes. It's easier to beg for forgiveness than to look before you leap. You just use your parameters regardless of types and let the exceptions fly.
link
DeepDuh
5049 days ago
Is that really Pythonic? Isn't that just general best practice in programming?
link