Team4819 / 4819-2014-Offseason-RobotPy

Python code for 2014 robot with in-development module framework
0 stars 0 forks source link

Simpler interface idea #1

Closed virtuald closed 9 years ago

virtuald commented 9 years ago

Referring to the hello world module (https://github.com/Team4819/4819-2014-Offseason-RobotPy/blob/master/modules/examples/hello_world_module.py):

Perhaps instead of requiring an 'inverse callback', just provide a generator to anything that you call, and have the generator return False when the code needs to exit the function. There are a lot of asynchronous frameworks in python that do a similar thing already (like tornado).

computer-whisperer commented 9 years ago

Now that is a great idea! I had been wrestling for a while on how to better do that.

computer-whisperer commented 9 years ago

Implemented the concept in 71dda4450a8e55852ea976bb31aa91c530ea7af4. Not using generators, exactly, but an object passed to the function that has an "active" value, which will turn false upon event termination.