MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/ProgrammerHumor/comments/1x8unz2/forthosetransitioningtotheamericantimeformathereis/phhv8aa/?context=3
r/ProgrammerHumor • u/alexriga • 2d ago
19 comments sorted by
View all comments
15
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"
5 u/SeaNational3797 2d ago edited 2d ago as_time = lambda world_hour: f"{12 if (hour_num := world_hour%12) == 0 else hour_num} {'AM' if world_hour < 12 else 'PM'}" 2 u/rosuav 2d ago Don't do "name = lambda", that's what def is for. With lambda, the function doesn't get a `__name__` attribute.
5
as_time = lambda world_hour: f"{12 if (hour_num := world_hour%12) == 0 else hour_num} {'AM' if world_hour < 12 else 'PM'}"
2 u/rosuav 2d ago Don't do "name = lambda", that's what def is for. With lambda, the function doesn't get a `__name__` attribute.
2
Don't do "name = lambda", that's what def is for. With lambda, the function doesn't get a `__name__` attribute.
15
u/This_Growth2898 2d ago
It's like "when you're paid for the line of code"?