Skip to main content

%SYS.Python.IteratorHelper

Class %SYS.Python.IteratorHelper Extends %RegisteredObject [ System = 4 ]

Implementation of an iterator helper for Python

Properties

%Iterator

Property %Iterator As %Collection.AbstractIterator [ Transient ];

Abstract iterator that we are iterating on

%Mode

Property %Mode As %String(VALUELIST = ",values,keys,both") [ InitialExpression = "values", Required, Transient ];

Mode flag

%Key

Property %Key As %String;

Current iterator key

Methods

%OnNew

Method %OnNew(iter As %Collection.AbstractIterator, mode As %String = "") As %Status

Initialize this iterator helper

"next"

Method "__next__"() As %String

Python iterator implementation

"iter"

Method "__iter__"() As IteratorHelper

Allows an "iterator on an iterator", note that it does NOT reset then "index" it just continues on and this doesn not "clone", it's a reference as per Python behavior

"len"

Method "__len__"() As %Integer

Return the length of the iterable collection (if known)

"contains"

Method "__contains__"(item As %Any) As %Boolean

Check to see if this iterator contains the following