Python is a great language. It's readable, it looks nice, and it does lots of really cool things.
It's also got quirks.
For example:
x = [1, 2, 3, 4]
sets the variable x to be the list 1, 2, 3, 4. If you then set
y = x
and ask for y, it will also return the list 1-4. The weird part is what happens when you change x after this, then ask for y.
x = [2, 3, 4, 5]
>>>print(y)
[2, 3, 4, 5]
The reason for this is that the variables are pointing at the same object, instead of y being pointed at an independent duplicate of x. This caused a bug where instead of creating a 'piano roll' of valves on vs. last change, one loop in the code created a great big set of zeros.
I don't understand the point of this design choice on the part of the python developers, but I found a way to deal with it.
In other news, solenoids arrived. They're very small.
Very small.
They also draw 600 mA at 12v, which is inconvenient. They get extremely hot in a short period of time, and therefore are not suitable for connection to the control board without current-limiting resistors.
No comments:
Post a Comment