Hacker News new | past | comments | ask | show | jobs | submit login

Yep. Because the dictionary literal gets created via opcodes in the interpreter loop whereas the named tuple pays the price of calling a function and setting up an interpreter frame.

The --setup code (creating the namedtuple and dict) is only executed once.

The timed portion is simply the field accesses.

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact