Java method name colliding with Python reserved word

Never really thought about this before now, but it just occurred to me while staring at some code that works with QualiityCode objects that my editor was highlighting the is() method differently because is is a Python reserved word.

How does this work in Jython without blowing up? In this one case I guess the interpreter can guess I mean the object method because of the way I’ve attached .is() to an object reference. But, this feels like a very slippery slope.

Is there some guidance in the Jython docs about how to handle when your Java objects have names which collide with reserved words?

EDIT: I just checked and mypy has a fit with that QualityCode.is() :stuck_out_tongue:

Because it's an instance method you're fine, there's no collision. There's no way, to my knowledge (at least not without deliberate malice) to introduce something into the namespace that would collide - ultimately the special treatment of is is a function of the Python/Jython parser.

That said, the choice of is is one that I'd say we'd make differently today - we don't write any code in Python, but we do write Kotlin code internally, which uses the is the same as Python instead of Java's longer instanceof, and there it does cause issues, so you have to escape it inline:

assertTrue(result.quality.`is`(QualityCode.Error_ExpressionEval))