Python: Generator Cleanup

This code in this post is in Python 3, but aside from “cosmetic” differences,such as next(g) vs g.next() it applies to Python 2 as well. Read more

Similar

Python Hackathon at trivago

Hackathons! That’s where you feel super excited about creating something interesting, or useful, or just entertaining. They are a great way to encourage creativity and teamwork. Recently, trivago hosted a Python Hackathon in collaboration with the Python ... (more…)

Read more »

My favorite terrible Python error message

Students in my Python classes occasionally get the following error message: TypeError: object() takes no parameters This error message is technically true, as I’ll explain in a moment. But it’s surprising and confusing for people who are new to Python, be... (more…)

Read more »