9,867 karma · joined Aug 20, 2015 (11y ago) · 5,528 submissions
comment 1y ago · link · parent
comment 1y ago · link · parent
Doesn't that apply equally to every Western product which has a CPU? Like that cars made by a billionaire who makes rockets and digs tunnels?
comment 1y ago · link · parent
For example, make an export version of GPU that has very poor precision and makes mistakes in calculations. Nobody notices if the pixels in a game are colored little wrong, but you cannot do science on such a GPU.
Also restrict export of scientific data. Keep monopoly on manufacturing things.
comment 1y ago · link · parent
So what I am asking, if you are making a GPU-based rendering toolkit, please write also SIMD software fallback without shaders. Remember how fast Windows 95 was and make it a little bit faster.
comment 1y ago · link · parent
assert sorted(x) == sorted(y)
If you want to add map, then you have to write assert list(sorted(i.getValue() for i in someCollection)) == [3, 4, 5]
If the list contains non-sortable values, but they are hashable and unique, you can use sets: assert set(x) == set(y)
If the values are not unique, but hashable, you can use a counter (like a set but with count for repeating values): assert Counter(x) == Counter(y)
(by the way I learned about this trick from a LLM)And if the values are neither sortable, nor hashable, you'll have to write a helper function.
But still, pytest tests are less wordy and they don't require you to create a class.
This situation is familiar to me, I had to write such helper function when writing tests in PHP, for some reason it is not included in PHPUnit assertions.
comment 1y ago · link · parent
comment 1y ago · link · parent
Pytest shows the diff as well when using assert:
> assert y == x
E assert [1, 2, 3] == [1, 4, 3, 6]
E
E At index 1 diff: 2 != 4
E Right contains one more item: 6
E Use -v to get more diff