# A Common-Sense Guide to Data Structures and Algorithms in Python, Volume 1: Pg 244 pop\_head method

**URL:** <https://forum.devtalk.com/t/a-common-sense-guide-to-data-structures-and-algorithms-in-python-volume-1-pg-244-pop-head-method/216512>\
**Category:** PragProg Customers\
**Tags:** book-a-common-sense-guide-to-data-structures-and-algorithms-in-python-volume-1, errata\
**Created:** [28 September 2025 19:46 UTC](https://forum.devtalk.com/t/a-common-sense-guide-to-data-structures-and-algorithms-in-python-volume-1-pg-244-pop-head-method/216512 "2025-09-28T19:46:30Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![adam](https://forum.devtalk.com/letter_avatar_proxy/v4/letter/a/4af34b/32.png) [@adam](https://forum.devtalk.com/u/adam)\
**Post date:** [28 September 2025 19:46 UTC](https://forum.devtalk.com/t/a-common-sense-guide-to-data-structures-and-algorithms-in-python-volume-1-pg-244-pop-head-method/216512/1 "2025-09-28T19:46:30Z")

</div>

pop\_head method needs check before attempting to assign

```auto
self.first_node.previous_node = None

```

This is needed if Queue has only one element. The initial self.first\_node = self.first\_node.next\_node is None

Example fix:

```auto

    def pop_head(self):
        if not self.first_node:
            return None

        popped_node = self.first_node
        self.first_node = self.first_node.next_node
        if self.first_node:
            self.first_node.previous_node = None
        return popped_node

```
