krzema12 / kotlin-python

Python target for the Kotlin Programming Language. See https://github.com/krzema12/kotlin-python/tree/python-backend/python
https://discuss.kotlinlang.org/t/idea-python-backend/19852
48 stars 1 forks source link

Support multiple comparisons: `0 <= limit < count` instead of `0 <= limit and limit < count` #53

Open krzema12 opened 2 years ago

krzema12 commented 2 years ago

Originally created by @SerVB.

krzema12 commented 2 years ago

Why is it needed? Just to generate prettier Python? I'm also not sure if there's a Kotlin counterpart so that we can translate it 1:1 to Python.

SerVB commented 2 years ago

Yep, it's just Pythonification.

When we have x in 0..1 or 0 <= x && x <= 1 in Kotlin, we now have 0 <= x and x <= 1 in the best case (or even something uglier as described in #54).

This issue is about that it would be cool to have just Python-ish 0 <= x <= 1 here.