Hi, and thanks for the reply :)
Yeah, I was thinking of using a dictionary in a similar fashion, where one key-value pair is used to indicate if there was any trouble or not.
Having a key error seems like a nice way to create the necessary feed back in a standardized way.
try:data=get_one({"name":"joe"})exceptConnectionError:# handle a ConnectionError
else:# if no exceptions were raised then the data is presumed to be good
do_something_with(data)
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Hi, and thanks for the reply :)
Yeah, I was thinking of using a dictionary in a similar fashion, where one key-value pair is used to indicate if there was any trouble or not.
Having a key
error
seems like a nice way to create the necessary feed back in a standardized way.this is preferable