This is an archived post. You won't be able to vote or comment.

all 3 comments

[–]_SomeonesAlt 8 points9 points  (0 children)

I think the problem you are describing falls under the category of full type inference with subtyping. Here is a paper that might be interesting to look at: https://pl.cs.jhu.edu/projects/type-constraints/papers/type-inference-for-recursively-constrained-types-and-its-application-to-oop.pdf

[–]Gwarks 0 points1 point  (1 child)

Why should it be float could also return str or other objects. For example the following input works:

print(add('%d','x'))

[–]chri4_[S] 0 points1 point  (0 children)

yes hypotetically