News for hackers. Stuff that matters.
Re:Python types have an expectations problem by yoyohello13 on Monday January 29, 2024 @11:25AM (#39178176)
You can annotate OR types in python so in this case you could do

def fooify(x: int | list[int])

Re:Python types have an expectations problem by pharmakom on Monday January 29, 2024 @03:26PM (#39182010)
But if x is an int, the result is an int

If x is a list, the result is a list

I don’t think that the type system can describe this.

Re:Python types have an expectations problem by olejorgenb on Monday January 29, 2024 @07:19PM (#39184670)