Maven (famous)@lemmy.zip to Programmer Humor@programming.dev · 9 months agoModern Programminglemmy.zipimagemessage-square73linkfedilinkarrow-up1353arrow-down14
arrow-up1349arrow-down1imageModern Programminglemmy.zipMaven (famous)@lemmy.zip to Programmer Humor@programming.dev · 9 months agomessage-square73linkfedilink
minus-squarelime!@feddit.nulinkfedilinkEnglisharrow-up6·edit-29 months agono, the linked table shows how python also returns the first non-falsey result of an a or b expression rather than just giving a boolean. it’s useful for initialising optional reference args: def foo(a: list = None) a = a or [] works with and as well.
no, the linked table shows how python also returns the first non-falsey result of an
a or bexpression rather than just giving a boolean. it’s useful for initialising optional reference args:works with
andas well.