#Km91#@sh.itjust.works to TenForward: Where Every Vulcan Knows Your Name@lemmy.world · 1 year agoMachine learningsh.itjust.worksimagemessage-square42linkfedilinkarrow-up1679arrow-down111
arrow-up1668arrow-down1imageMachine learningsh.itjust.works#Km91#@sh.itjust.works to TenForward: Where Every Vulcan Knows Your Name@lemmy.world · 1 year agomessage-square42linkfedilink
minus-squareArtVandelay@lemmy.worldlinkfedilinkEnglisharrow-up12arrow-down1·edit-21 year 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-squareArtVandelay@lemmy.worldlinkfedilinkEnglisharrow-up8·1 year 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·1 year agoIf you want to write Python like a caveman, then sure
minus-squareEcho Dot@feddit.uklinkfedilinkarrow-up2·1 year agoIf you’re just going to define a variable and then return it there’s no reason to do it in a function.
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.
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
If you’re just going to define a variable and then return it there’s no reason to do it in a function.