MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/ProgrammerHumor/comments/1x8unz2/forthosetransitioningtotheamericantimeformathereis/phfzhf1/?context=3
r/ProgrammerHumor • u/alexriga • Oct 18 '26
22 comments sorted by
View all comments
14
It's like "when you're paid for the line of code"?
def as_time(world_hour=world_hour): return f"{(world_hour-1)%12+1} {'PA'[world_hour<12]}M"
4 u/SeaNational3797 Oct 18 '26 edited Oct 18 '26 as_time = lambda world_hour: f"{12 if (hour_num := world_hour%12) == 0 else hour_num} {'AM' if world_hour < 12 else 'PM'}" 4 u/minecon1776 Oct 18 '26 011101011101100011111010001010111000110110101010010101110000000101010101111010100101011101010010111010001101010010010101101011101001010101011100011010101011111010011101011011011001001010010101010 2 u/rosuav Oct 18 '26 Don't do "name = lambda", that's what def is for. With lambda, the function doesn't get a `__name__` attribute.
4
as_time = lambda world_hour: f"{12 if (hour_num := world_hour%12) == 0 else hour_num} {'AM' if world_hour < 12 else 'PM'}"
4 u/minecon1776 Oct 18 '26 011101011101100011111010001010111000110110101010010101110000000101010101111010100101011101010010111010001101010010010101101011101001010101011100011010101011111010011101011011011001001010010101010 2 u/rosuav Oct 18 '26 Don't do "name = lambda", that's what def is for. With lambda, the function doesn't get a `__name__` attribute.
011101011101100011111010001010111000110110101010010101110000000101010101111010100101011101010010111010001101010010010101101011101001010101011100011010101011111010011101011011011001001010010101010
2
Don't do "name = lambda", that's what def is for. With lambda, the function doesn't get a `__name__` attribute.
View all comments
14
u/This_Growth2898 Oct 18 '26
It's like "when you're paid for the line of code"?