Blog
Python iterators considered harmful
I just tracked down a nasty bug in my code to a gotcha with Python iterators. Consider the following code... class Numbers(list): def even(self): for val in self: if val % 2 == 0: …
Topic
3 matching pages
Blog
I just tracked down a nasty bug in my code to a gotcha with Python iterators. Consider the following code... class Numbers(list): def even(self): for val in self: if val % 2 == 0: …
Blog
If you like using a single getter/setter function for your properties, watch out if using None for the default. If you do that you won't be able to set your property to None! …
Blog
Recently I've been going over the Hub logs and fixing issues which have caused exceptions to be raised in the application. One in particular had me stumped for a while. An …