Summary
I ran into this issue when working with pyspark's Col type (from pyspark.sql.functions import col).
Here's a minimal reprex:
from typing import Callable
# Note: removing the return annotation 'fixes' the issue :)
def make_less_than() -> Callable[["MyClass", "MyClass"], bool]:
def _(x: "MyClass", y: "MyClass") -> bool:
return x.val < y.val
return _
class MyClass:
def __init__(self, val: int):
self.val = val
__lt__ = make_less_than()
MyClass(1) < MyClass(2) # Operator `<` is not supported for types `MyClass` and `MyClass` [unsupported-operator]
Playground link: https://play.ty.dev/d17232fa-2da8-4c04-baa7-45036bf59418
Many thanks! I've been playing around with ty on a pretty bit project and this is really the only issue I've found. Overall a fantastic experience for a project which is still in alpha ⭐
Version
ty 0.0.1-alpha.21 (ef52a19 2025-09-19)