Please use text mail for posting, and please use reply-list, or whatever your mailer calls it when adding to a thread. So far, you've got at least 3 threads covering a single topic.
Bill Bright <wcb_...@bellsouth.net> Wrote in message: > > The code below seems to work. My question is why does oldstates need to be multiplied by 32? Does this means the code will only read 32 switch changes? That would be a problem. If you're just learning Python, you need to actually play with each new concept you encounter. When you multiply a list by an int n, you create a new list, n times as big. Experiment with this in the interpreter, till you understand. ["A", "f", 42] *3 [] * 4000 [True, False] * 10 So you wind up with 32 flags in the oldstates list. Why 32? I don't have a rpi, so I took the wild guess that a Raspberry Pi might have 32 inputs. You're only using 3, so you could have used a list of 3, or a dict. But I was trying for the minimum complication. Others have mentioned an event loop in GPIO. Assuming such exists, it would be better to use it. -- DaveA _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor