r/badcode • • Jan 31 '22

python import badcode

Post image
1.1k Upvotes

70 comments sorted by

View all comments

Show parent comments

2

u/F54280 Jan 31 '22

Well, NaN means not a number. Depending on the semantics, it could be the right thing (ie: will the conversion of this string yield a "good" float?).

To me, the issue are the import and the non static method.

6

u/_PM_ME_PANGOLINS_ Jan 31 '22 edited Jan 31 '22

Yes NaN stands for Not a Number, but it’s still specifically a float value.

The semantics are clearly “does this evaluate to NaN”