What sort of exception when a class can't find something?
Chris Green
cl at isbd.net
Thu Aug 31 16:32:04 EDT 2023
What sort of exception should a class raise in __init__() when it
can't find an appropriate set of data for the parameter passed in to
the class instantiation?
E.g. I have a database with some names and address in and have a
class Person that gets all the details for a person given their
name.
....
....
person.Person('Fred')
...
...
If Fred doesn't exist in the database what sort of exception should
there be? Is it maybe a ValueError?
--
Chris Green
·
More information about the Python-list
mailing list