Better HN
topnewbestaskshowjobs
Log inSign up

HZet0r

3 karma · joined Mar 19, 2015 (11y ago) · 3 submissions

Submissions

comment 11y ago · link · parent

There is a LRU cache in the standard library starting in 3.2: https://docs.python.org/3/library/functools.html#functools.l...

Doesn't have quite the same options, but arguably nicer to use because it's a decorator.

comment 11y ago · link · parent

You're right - good point. For one way, I guess you could let p_i represent the ith prime number (there are infinitely many) and use p_x / p_y instead. Unsure about the other way.

comment 11y ago · link · parent

If the pixels are laid out in a grid then each has a coordinate (x, y), where x and y are integers. Then we form a bijection (x, y) <-> x/y and we see that there are as many pixels as rational numbers. We know that the set of rational numbers is countably infinite, so the number of pixels is countably infinite.