JPDev@programming.dev to Programmer Humor@programming.dev · 9 months agoReturns a sorted list in O(1) timeprogramming.devimagemessage-square13fedilinkarrow-up1284arrow-down113
arrow-up1271arrow-down1imageReturns a sorted list in O(1) timeprogramming.devJPDev@programming.dev to Programmer Humor@programming.dev · 9 months agomessage-square13fedilink
minus-squareTrailblazing Braille Taser@lemmy.dbzer0.comlinkfedilinkarrow-up10·9 months agoBesides the obvious flaws… is that parameter a list named list, shadowing the list() constructor?
minus-squareinfinitepcg@lemmy.worldlinkfedilinkarrow-up5·9 months agoIt works as long as you don’t call list() within that function.
minus-squareSpecies5218@sh.itjust.workslinkfedilinkarrow-up1arrow-down2·9 months agoThat is a type hint
minus-squareTrailblazing Braille Taser@lemmy.dbzer0.comlinkfedilinkarrow-up3·9 months agoWell duh. I wonder what happens if you shadow the list constructor and try to use it as a type hint… def foo(list: list): def bar(thingies: list): pass
Besides the obvious flaws… is that parameter a list named
list
, shadowing thelist()
constructor?It works as long as you don’t call
list()
within that function.That is a type hint
Well duh. I wonder what happens if you shadow the list constructor and try to use it as a type hint…
def foo(list: list): def bar(thingies: list): pass