2015/10/29

Python is dumb. Also, tiny solenoids!

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.
They're so 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.

In addition, they are pull-type but have no return spring, so I need to do something about that. I found a company online called Century Spring and I've asked for a sample of the springs (tapered and very small diameter, impossible to find elsewhere) and E-clips (1 mm groove diameter, unreasonably expensive in many places, less than 3¢ per at CS), which they have agreed to send. I'm hopeful in that department, although I'm a bit disappointed that there's seemingly no inexpensive, simple solution for this part of the project. I don't mind fiddly bits and occasional kludging to make something work, but having to go through three or four different companies just to get solenoids sorted seems a bit much.

No comments:

Post a Comment