Open vxe opened 2 months ago
You can repeatedly call the python's next
operator on the iterator/generator, until it raises a StopIteration error.
(defpackage :python-user
(:use :cl)
(:local-nicknames (:utils :alexandria)
(:py :py4cl)))
(in-package :python-user)
(let ((range (py:python-eval "iter(range(2))")))
(loop :for obj := (utils:ignore-some-conditions (py:python-error)
(py:python-call "next" range))
:while (print obj)))
equivalent in python:
thanks in advance