---
title: "Comment by Terry on \"Everything You Need to Know About Python's Namedtuples\" | Hashnode"
description: "Note that field ordering of dict s is only maintained in newer python versions ( officially since 3.7, but also in CPython 3.6 ). &gt;&gt;&gt; c = { &quot;r&quo"
url: "https://hashnode.com/posts/everything-you-need-to-know-about-pythons-namedtuples/5f6e3f4fade1fb598d439946/comment/5f73a1a7f955ec0a130f6ac3"
---

[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)

[Terry](https://hashnode.com/@terrd)

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

Note that field ordering of `dict`s is only maintained in newer python versions ([officially since 3.7, but also in CPython 3.6](https://stackoverflow.com/a/39980744/9560908)).

```
>>> c = {"r": 50, "g": 205, "b": 50, "alpha": alpha}
>>> Color = namedtuple("Color", c)
>>> Color(**c)
Color(r=50, g=205, b=50, alpha=0)
```

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

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

Hi [Terry](https://hashnode.com/@terrd), yes, you are right about the order. This example was aimed to demonstrate how to create the named tuple regardless of the key ordering. The idea is that we always use it by providing keyword arguments. This way the order doesn't make a difference. Like this:

```
In [2]: alpha = 0.3

In [3]: c = {"r": 50, "g": 205, "b": 50, "alpha": alpha}

In [4]: from collections import namedtuple

In [5]: Color = namedtuple("Color", c)

In [6]: Color(**c)
Out[6]: Color(r=50, g=205, b=50, alpha=0.3)

In [7]: Color(g=205, r=50, b=50, alpha=0.2)
Out[7]: Color(r=50, g=205, b=50, alpha=0.2)
```
