Coming soon - Get a detailed view of why an account is flagged as spam!
view details

This post has been de-listed

It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.

2
Error handling in classes
Post Body

Howdy all.

I've recently undertaken the task of writing my own little game in Python. So far it's been... difficult. But, I'm not here to whine! I'm here to ask a question. I have some beefy classes going on, and some of them depend on user input to be instantiated. Naturally, this means there's a lot of room for invalid inputs. So, my question is thus: What's the best practice when doing error handling for classes. Do you handle it in the class, do you handle it before it's passed, or do you offload the error handling to elsewhere?

Sorry if this question makes no sense, I don't really know how else to put it!

Thanks in advance for your time. Stay frosty.

Author
Account Strength
70%
Account Age
2 years
Verified Email
Yes
Verified Flair
No
Total Karma
4,581
Link Karma
570
Comment Karma
3,960
Profile updated: 4 days ago
Posts updated: 1 month ago

Subreddit

Post Details

We try to extract some basic information from the post title. This is not always successful or accurate, please use your best judgement and compare these values to the post title and body for confirmation.
Posted
7 months ago