Coder Social home page Coder Social logo

Comments (4)

terrytangyuan avatar terrytangyuan commented on August 25, 2024

Thanks for the report! This is indeed something we are missing. I imagine we can add an S3 method next() that works on iterator/generator objects. @jjallaire Do you see any potential problems?

from reticulate.

jjallaire avatar jjallaire commented on August 25, 2024

Good catch! Just added an iter_next function for this. Docs are here: https://rstudio.github.io/reticulate/articles/introduction.html#element-level-iteration

from reticulate.

nakamichiworks avatar nakamichiworks commented on August 25, 2024

Thank you for a very quick fix !

from reticulate.

jjallaire avatar jjallaire commented on August 25, 2024

Note that the default completed value for iter_next has just changed from NA to NULL (although you can always use the completed parameter to change this). Here are the update docs: https://rstudio.github.io/reticulate/articles/introduction.html#iterators

If you want to write code that works correctly with both the current version of reticulate on CRAN and the next version (master) just explicitly specify completed = NA rather than relying on the default.

Note that this change was made as part of adding support for creating generators (Python iterators implemented as R functions). Docs on generators are here: https://rstudio.github.io/reticulate/articles/introduction.html#generators

from reticulate.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.