A question came up recently about the purpose of the Python yield expression and when you should use it. Consider this silly function that computes a list of integers from 0 to 99 raised to the given exponent: When called, this function runs thru all 100 integers in the range computing each term and then returns the… Continue reading What The Heck Is Yield For?
Articles on generators
Code Challenge 11 – Generators for Fun and Profit
By PyBites Team on 20 March 2017
A new week, a new ‘bite’ of Python coding! After last week’s article on generators we will get you to practice a bit more with them in our new challenge. Good luck and have fun.
Generators are Awesome, Learning by Example
By Julian Sequeira on 17 March 2017
Learn what a Generator is and check out some different examples.
Code Challenge 09 – The With Statement and Context Managers
By PyBites Team on 6 March 2017
A new week, more coding! This week we have a free form exercise. This week you will implement your own Context Manager (= support with on your object).
5 tips to speed up your Python code
By Bob Belderbos on 21 February 2017
In this post I will give you 5 tips to speed up your code.
Code Challenge 01 – Word Values Part I – Review
By PyBites Team on 13 January 2017
Wow! We have been amazed by the great response on github and HN. It’s Friday so we review the code challenge of this week. We describe our learning and a possible solution. We will also digest comments left on the Monday post.
5 cool things you can do with itertools
By Bob Belderbos on 12 January 2017
Itertools is a very useful module. In this short post I show some 5 examples how you can use it. Some of this stuff might be useful in next week’s challenge …
3.6 new features
By Bob Belderbos on 31 December 2016
Finally got a chance to look into Python 3.6’s new features. In this post some highlights and pointers.
How to create a nice-looking HTML page of your Kindle book highlights (notes)
By Bob Belderbos on 26 December 2016
In this post I share a simple script to convert Bookcision JSON into a HTML page for your blog.