1
77
2
156
print('butt') (lemmy.world)
3
211
submitted 21 hours ago by yogthos@lemmy.ml to c/programmerhumor@lemmy.ml
4
50
5
344
6
385
7
417
8
303
submitted 6 days ago* (last edited 6 days 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.

9
1313
10
516
11
464
12
207
13
501
14
530
15
191
js Monk and Fly (sh.itjust.works)
16
848
17
942
Certified in AI (sh.itjust.works)
18
176
Let's do micro service (sh.itjust.works)
19
504
I am a sinner (sh.itjust.works)
20
175
21
782
22
296
23
220
submitted 1 week ago* (last edited 1 week ago) by Kristofers_Solo@lemmy.ml to c/programmerhumor@lemmy.ml
24
449
got him (lemy.lol)
submitted 1 week ago by ngn@lemy.lol to c/programmerhumor@lemmy.ml
25
289
view more: next ›

Programmer Humor

30800 readers
566 users here now

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

Rules:

founded 4 years ago
MODERATORS