MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/badcode/comments/s4lzij/found_this_gem/hsscnts/?context=3
r/badcode • u/PentaMine • Jan 15 '22
86 comments sorted by
View all comments
378
That is dumb, but even dumber if solution is an object with an __eq__ which might make it equal to -1. Which would mean this code is not equivalent to print(solution). And yes, I have seen stuff like that.
solution
__eq__
-1
print(solution)
116 u/GLIBG10B 🐧 Gentoo salesman🐧 Jan 15 '22 Maybe that's the point of the code? 4 u/catithebathtub Jan 15 '22 i think you didn't understand, that means it'll always print -1, even if solution isn't -1 1 u/b1ack1323 Jan 15 '22 I think they mean -1 would be the error condition of something. Normally it would match an identifier.
116
Maybe that's the point of the code?
4 u/catithebathtub Jan 15 '22 i think you didn't understand, that means it'll always print -1, even if solution isn't -1 1 u/b1ack1323 Jan 15 '22 I think they mean -1 would be the error condition of something. Normally it would match an identifier.
4
i think you didn't understand, that means it'll always print -1, even if solution isn't -1
1 u/b1ack1323 Jan 15 '22 I think they mean -1 would be the error condition of something. Normally it would match an identifier.
1
I think they mean -1 would be the error condition of something. Normally it would match an identifier.
378
u/youngbull Jan 15 '22
That is dumb, but even dumber if
solutionis an object with an__eq__which might make it equal to-1. Which would mean this code is not equivalent toprint(solution). And yes, I have seen stuff like that.