When we originally designed the ev3dev-lang libraries, we based them all on a concept where devices would expose a connected property to indicate whether they had successfully found a device matching the parameters from the constructor. This has led to a lot of code that looks like this:
m = ev3.Motor(ev3.OUTPUT_A)
assert m.connected
...and lots of confused users as a result (especially when they don't know to include that assertion).
Do we want to change this behavior? I think it would make sense at this point to throw an exception from the constructor. This would be just for this library and wouldn't necessarily require a change to others.
When we originally designed the ev3dev-lang libraries, we based them all on a concept where devices would expose a
connectedproperty to indicate whether they had successfully found a device matching the parameters from the constructor. This has led to a lot of code that looks like this:...and lots of confused users as a result (especially when they don't know to include that assertion).
Do we want to change this behavior? I think it would make sense at this point to throw an exception from the constructor. This would be just for this library and wouldn't necessarily require a change to others.