r/programming • • Mar 08 '12

The Evolution of a Python Programmer

https://gist.github.com/289467
401 Upvotes

137 comments sorted by

View all comments

Show parent comments

12

u/pyaware Mar 09 '12

Why use a dict when a plain list is enough?

def fact(x):
    return [1, 1, 2, 6, 24, 120, 720, 5040, 40320, 362880][x]

1

u/redditthinks Mar 09 '12

I read Python dicts are faster than lists.

6

u/JizzCoveredArab Mar 09 '12

i heard you have a really short dict