__iter__ - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.
Our website is currently undergoing maintenance, which may result in occasional errors while browsing. We apologize for any inconvenience this may cause and are working swiftly to restore full functionality. Thank you for your patience.

Online Help

All Products    Maple    MapleSim


__iter__

return iterator to traverse the Indexable

 

Calling Sequence

Parameters

Description

Examples

Calling Sequence

x.__iter__()

iter(x)

Parameters

x

-

Indexable object

Description

• 

__iter__ function returns a Python Iterator object for the Indexable x.

• 

This allows Python-style iteration over the elements contained in the Indexable.

• 

This function can also be called by simply entering iter(x) or used implicitly, such as in a for-in loop.

Examples

The following interactive session illustrates the use of an iterator used implicitly in a for-in loop over the container structure.

>>> import maple

>>> import maple.namespace

>>> S = maple.execute('{3,4,2*Pi,sqrt(2)};')

>>> for x in S: print(x)

3

4

2^(1/2)

2*Pi

See Also

OpenMaple

OpenMaple/Python/API

OpenMaple/Python/Expression

OpenMaple/Python/Indexable

OpenMaple/Python/Indexable/__contains__

OpenMaple/Python/Indexable/__len__