Hacker News new | ask | show | jobs
by the_mitsuhiko 4507 days ago
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.
1 comments

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

The timed portion is simply the field accesses.