MeadSteve@reddthat.com to Python@programming.dev • 1 year agoTyped Python: Choose Sequence over Listexternal-linkmessage-square6 fedilinkarrow-up114file-text
arrow-up114external-linkTyped Python: Choose Sequence over ListMeadSteve@reddthat.com to Python@programming.dev • 1 year agomessage-square6 Commentsfedilinkfile-text
minus-squarejadelord@discuss.tchncs.dehexbear4·1 year agoGood point, and Łukasz Langa mentioned this in his talk (check it out). He names it the robustness principle, in his words (around 22:20 mark: "Vague in what you accept, concrete in what you return" But he also mentions some gotchas like how Iterable[str] can backfire, because str is also an Iterable[str] and it might be better to use list[str]. linkfedilink
Good point, and Łukasz Langa mentioned this in his talk (check it out). He names it the robustness principle, in his words (around
22:20
mark:But he also mentions some gotchas like how
Iterable[str]
can backfire, becausestr
is also anIterable[str]
and it might be better to uselist[str]
.