Kothon is a Python library designed to bring the elegance and functionality of Kotlin's Sequence class into the Python ecosystem. With an emphasis on functional programming paradigms, Kothon enables Python developers to leverage lazy-evaluated sequences, allowing for efficient and expressive data processing pipelines.
Project description
Kothon
Kothon is a Python library designed to bring the elegance and functionality of Kotlin's Sequence class into the Python ecosystem. With an emphasis on functional programming paradigms, Kothon enables Python developers to leverage lazy-evaluated sequences, allowing for efficient and expressive data processing pipelines.
Features
- Lazy Evaluation: Kothon sequences are evaluated lazily, meaning computations are deferred until the value is needed, enhancing performance especially for large datasets.
- Functional Programming: Embrace functional programming with a rich set of operators like
map
,filter
,reduce
, and much more, enabling you to write more declarative and concise code. - Interoperability: Seamlessly integrate with existing Python codebases, enjoying the benefits of Kotlin-like sequences without disrupting your current workflow.
- Easy to Use: Kothon's API is designed to be intuitive for both Python and Kotlin developers, ensuring a smooth learning curve.
Installation
To install Kothon, simply run the following command in your terminal:
pip install kothon
Quick Start
Here's a quick example to get you started with Kothon:
from kothon import Seq
# Create a Kothon sequence
seq = Seq(range(10))
# Apply some functional operations
result = seq \
.filter(lambda x: x % 2 == 0) \
.map(lambda x: x * 2) \
.to_list()
print(result) # Output: [0, 4, 8, 12, 16]
Contributing
We welcome contributions! If you have improvements or bug fixes, please feel free to create a pull request.
License
Kothon is released under the MIT License. See the LICENSE file for more details.
Acknowledgments
Kothon is inspired by the Kotlin Sequence class and the broader functional programming paradigm. We are grateful to the Kotlin community for their innovative work, which has inspired the creation of this library.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.