Learn To Loop The Python Way: Iterators And Generators Explained

If you’ve ever written any Python at all, the chances are you’ve used iterators without even realising it. Writing your own and using them in your programs can provide significant performance improvements, particularly when handling large datasets or running in an environment with limited resources. They can also make your code more elegant and give you “Pythonic” bragging rights.

Here we’ll walk through the details and show you how to roll your own, illustrating along the way just why they’re useful.

Continue reading “Learn To Loop The Python Way: Iterators And Generators Explained”

Light Switch For The Lazy

[Will Donaldson] has whipped up a quick hack for anyone thinking of dipping their toe into home automation — or otherwise detest flicking off the bedroom light before navigating their way to their bed: a remote control light switch!

This remote switch uses a sg90 servo, an Arduino Uno, and pairs of ATtiny85s with HC-05 Bluetooth modules assembled on protoboards. The 3D printed mount screws easily on top of a standard light switch cover while still allowing the switch to be flipped the old-fashioned way. It’s also perfect as a temporary solution — [Donaldson] is presently renting his apartment — or for those unwilling to mess with the mains power of their abode.

Continue reading “Light Switch For The Lazy”