Python Series: The for Loop

Python Series: The for Loop

The essence of the for loop is the application of the iterator protocol, which retrieves elements one by one using iter() and next(), until the stopIteration exception is raised.1. iter is a built-in function in Python that converts an object into an iterator.2. next() retrieves elements one by one, and raises an exception if there … Read more

C++ Wheel-Making: Handcrafted List Container

C++ Wheel-Making: Handcrafted List Container

In C++, a List is essentially a doubly linked circular list with a head node. Sounds a bit convoluted, right? Many friends struggle to understand the difference between List and vector when they first learn about it… Please take a look at this image 👇 Image: A doubly linked circular list with a head node, … Read more

Design Patterns: Exploring Embedded C Language Implementation – Iterator Pattern

Design Patterns: Exploring Embedded C Language Implementation - Iterator Pattern

Introduction:This article will briefly describe the Iterator Pattern from the book Head First Design Patterns and implement this pattern using C language. It will also explain the key features of C language used in the implementation.Background of the Iterator Pattern: In the book Head First Design Patterns, the background story of the Iterator Pattern is … Read more