this post was submitted on 13 Feb 2026
113 points (92.5% liked)
Programmer Humor
29749 readers
2352 users here now
Welcome to Programmer Humor!
This is a place where you can post jokes, memes, humor, etc. related to programming!
For sharing awful code theres also Programming Horror.
Rules
- Keep content in english
- No advertisements
- Posts must be related to programming or programmer topics
founded 2 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
Idk it works for me.
Also
"8:00:00" > "10:00:00"I don't think there is any possible value for the
signvariable which would make that if statement do anything other than raise aTypeError.but
"08:00:00" < "10:00:00". comparing timestamps as strings is weird but actually works, as long as the hour is zero-padded :)the problem with this code is that
&(bitwise AND) has higher operator precedence than>and==do, so it is first trying to bitwise AND"10:00:00"withsign(which i'm assuming would also be a string) and that will always raise aTypeError.to do what the author appears to have intended to do, they would either need use parenthesis around both comparisons to actually bitwise AND their results, or (better) to use the boolean AND operator (
and) instead of&.The boolean
andoperator is the right tool for the job, and since it is lower precedence it also wouldn't require that any parenthesis be added here.Heh you're right, I didn't catch the bitwise and, so I thought you were making a TypeError joke about comparing strings. Fixing the
andthough (which I did naturally when I typed it into my interpreter to double-check), we get the issue that they are just using a string for the time rather than a time object. "Too early" is also a valid entry that gets us an available office.