Open gabrieldemarmiesse opened 9 months ago
Thanks for opening the ticket! We will eventually get to this!
This is something that is a blocker for my team to adopt mojo for some of our python modules.
We will have to stick to Rust until this is implemented but would love to use mojo!
Implementing this will also help a python -> mojo transpiler, which could assist in implementing python stdlib in mojo via automated code translation.
Review Mojo's priorities
What is your request?
Currently, Mojo supports iterators, but it does require them to declare a
__len__
method, which is not something found in python. Furthermore, there is no trait associated to an iterator.Also said in the docs: https://docs.modular.com/mojo/roadmap.html#no-python-style-generator-functions Mojo doesn't support generators yet (with yield), but it's a extremely useful feature when creating libraries (especially the stdlib).
What is your motivation for this change?
I'm trying to replicate the Python's stdlib in Mojo and those features would make this task much much easier. The stdlib has iterators pretty much everywhere.
Any other details?
Congrats on the 0.6.0 which is awesome :)