Skip to content

Rethink "connected" attribute #372

@WasabiFan

Description

@WasabiFan

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.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions