#Km91#@sh.itjust.works to TenForward: Where Every Vulcan Knows Your Name@lemmy.world · 22 hours agoMachine learningsh.itjust.worksimagemessage-square36fedilinkarrow-up1562arrow-down110
arrow-up1552arrow-down1imageMachine learningsh.itjust.works#Km91#@sh.itjust.works to TenForward: Where Every Vulcan Knows Your Name@lemmy.world · 22 hours agomessage-square36fedilink
minus-squareArtVandelay@lemmy.worldlinkfedilinkEnglisharrow-up9arrow-down1·edit-221 hours agodef hot(temp: int = 340): return temp That way Bev can define temp however she needs, but if Picard doesn’t specify, he gets his tea at a nice drinkable Kelvin temp.
minus-squareEcho Dotlinkfedilinkarrow-up1·8 hours agoIf you’re just going to define a variable and then return it there’s no reason to do it in a function.
minus-squareWhiskyTangoFoxtrot@lemmy.worldlinkfedilinkarrow-up3·20 hours agoShouldn’t that be a float?
minus-squareArtVandelay@lemmy.worldlinkfedilinkEnglisharrow-up7·19 hours agoPython is dynamically typed, so you could just go against the type hint like an animal. But yes, probably.
minus-squarewatersnipje@lemmy.blahaj.zonelinkfedilinkarrow-up1arrow-down1·17 hours agoIf you want to write Python like a caveman, then sure
def hot(temp: int = 340): return temp
That way Bev can define temp however she needs, but if Picard doesn’t specify, he gets his tea at a nice drinkable Kelvin temp.
If you’re just going to define a variable and then return it there’s no reason to do it in a function.
Shouldn’t that be a float?
Python is dynamically typed, so you could just go against the type hint like an animal. But yes, probably.
If you want to write Python like a caveman, then sure