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 list
Watch Me Code – Solving Bite 21. Query a Nested Data Structure
By Bob Belderbos on 14 July 2018
I recorded a video solving Bite 21. Query a nested data structure. The exercise presents us with a dictionary of car manufacturers and their corresponding car models. We will extract various bits and pieces from it as well as sort the nested model lists. This is a common type of data structure so specially for a beginner it is important to have this become second nature. Prepare to learn more about looping, some string operations, and list / dict comprehensions.
Don’t let mutability of compound objects fool you!
By Bob Belderbos on 7 March 2017
In this article I explain the difference between shallow versus deep copy with a working example. It’s an important concept when working with compound objects.