project8 / dripline

Slow controls for medium scale physics experiments based on AMQP centralized messaging
http://www.project8.org/dripline
1 stars 0 forks source link

required init args should default to None and raise an error #142

Closed laroque closed 9 years ago

laroque commented 9 years ago

Due to nested inheritance, it can be really hard to debug errors that look like TypeError: __init__() takes exactly 3 arguments (2 given)....

Solution:

use something that looks like this for init methods:

def __init__(self, some_required_arg=None, **kwargs):
    if some_required_arg is None:
        raise exceptions.DriplineValueError('a valid value for "some_required_arg" is required to __init__() <this class name>')
laroque commented 9 years ago

this should be fixed, at least in core; hopefully this will make it easier to debug broken config files.