---
title: "Comment by Paddy McCarthy on \"Everything You Need to Know About Python's Namedtuples\" | Hashnode"
description: "You stated: To add a hash method, you need to make them immutable by setting unsafe_hash to True The logic doesn&#39;t seem to fit the naming, and from how I in"
url: "https://hashnode.com/posts/everything-you-need-to-know-about-pythons-namedtuples/5f6e3f4fade1fb598d439946/comment/5f82da7d5841661b519d0f8c"
---

[Discussion](https://hashnode.com/posts/everything-you-need-to-know-about-pythons-namedtuples/5f6e3f4fade1fb598d439946)

Comment [Everything You Need to Know About Python's Namedtuples](https://hashnode.com/posts/everything-you-need-to-know-about-pythons-namedtuples/5f6e3f4fade1fb598d439946)

[Paddy McCarthy](https://hashnode.com/@Paddy3118)

[Oct 11, 2020](https://hashnode.com/posts/everything-you-need-to-know-about-pythons-namedtuples/5f6e3f4fade1fb598d439946/comment/5f82da7d5841661b519d0f8c)

You stated:

> To add a **hash** method, you need to make them immutable by setting unsafe\_hash to True

The logic doesn't seem to fit the naming, and from how I interpret the [docs](https://docs.python.org/3/library/dataclasses.html?highlight=unsafe_hash) you might do it this way but it is frowned on:

> Although not recommended, you can force dataclass() to create a **hash**() method with unsafe\_hash=True. This might be the case if your class is logically immutable but can nonetheless be mutated. This is a specialized use case and should be considered carefully.

It might be better to look at the settings of the eq and frozen parameters when `unsafe_hash=False`, (the default): Setting `eq=True, frozen=True` would then get a **hash** method generated.

Gosh, it takes my concentration to work this out :-)

[Miguel Brito](https://hashnode.com/@miguendes)

[Oct 17, 2020](https://hashnode.com/posts/everything-you-need-to-know-about-pythons-namedtuples/5f6e3f4fade1fb598d439946/comment/5f82da7d5841661b519d0f8c#reply-5f8abbca6eb39417ce5e5d15)

Thanks for the heads up [Paddy McCarthy](https://hashnode.com/@Paddy3118). It's a bit confusing indeed. I'll run some experiments and update the post.
