1
62
Total Recall (lemmy.world)
2
71

3
184
submitted 13 hours ago by fxdave@lemmy.ml to c/programmerhumor@lemmy.ml
4
157
Unit Tests (sh.itjust.works)
5
151
They never let me (sh.itjust.works)
6
225
The Onboarding (lemmy.ml)
7
1098
8
1534
Of course (lemmy.world)
9
780
Thanks ... (jlai.lu)
10
512
11
193

cross-posted from: https://lemmy.cringecollective.io/post/9716

Maybe some ALGOL 58 while we're at it too.

12
378
print('butt') (lemmy.world)
13
215
14
232
15
52
16
360
17
406
18
419
19
304
submitted 1 week ago* (last edited 1 week ago) by renzev@lemmy.world to c/programmerhumor@lemmy.ml

Explanation: Python is a programming language. Numpy is a library for python that makes it possible to run large computations much faster than in native python. In order to make that possible, it needs to keep its own set of data types that are different from python's native datatypes, which means you now have two different bool types and two different sets of True and False. Lovely.

Mypy is a type checker for python (python supports static typing, but doesn't actually enforce it). Mypy treats numpy's bool_ and python's native bool as incompatible types, leading to the asinine error message above. Mypy is "technically" correct, since they are two completely different classes. But in practice, there is little functional difference between bool and bool_. So you have to do dumb workarounds like declaring every bool values as bool | np.bool_ or casting bool_ down to bool. Ugh. Both numpy and mypy declared this issue a WONTFIX. Lovely.

20
1316
21
521
22
466
23
208
24
501
25
532
view more: next ›

Programmer Humor

30845 readers
704 users here now

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

founded 4 years ago
MODERATORS