EvalMember - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

All Products    Maple    MapleSim


Python

  

EvalMember

  

evaluate a Python member reference

 

Calling Sequence

Parameters

Description

Examples

Compatibility

Calling Sequence

EvalMember(s,n)

Parameters

s

-

string or Python object

n

-

string or name

Description

• 

The EvalMember command executes a class member operation, s.n, using the Python interpreter.

• 

By default the value returned is converted into a Maple data structure.  If no conversion is available, the return value will be an expression of type python, a Python object reference that can be used in subsequent calls to Python.

• 

The syntax, s:-n is usually preferred, but, in rare circumstances where evaluation of s is non-standard such that s may not be defined prior to forming the s:-n expression, the EvalMember(s,n) command can be used to resolve s.

• 

This function is part of the Python package, so it can be used in the short form EvalMember(..) only after executing the command with(Python). However, it can always be accessed through the long form of the command by using Python[EvalMember](..).

Examples

withPython:

ImportModulefrom bs4 import BeautifulSoup

htmldoc<html><body><h1>Great Novels</h1><ul><li><a href=\"http://MiguelDeCervantes.com\">Don Quixote</a><li><a href=\"http://FyodorDostoevsky.com\">Crime and Punishment</a><li><a href=\"http://AlexandreDumas.com\">The Count of Monte Cristo</a></ul></body></html>

htmldoc<html><body><h1>Great Novels</h1><ul><li><a href="http://MiguelDeCervantes.com">Don Quixote</a><li><a href="http://FyodorDostoevsky.com">Crime and Punishment</a><li><a href="http://AlexandreDumas.com">The Count of Monte Cristo</a></ul></body></html>

(1)

soupEvalFunctionBeautifulSoup&comma;htmldoc&comma;html.parser

soup<Python object: <html><body><h1>Great Novels</h1><ul><li><a href="http://MiguelDeCervantes.com">Don Quixote</a><li><a href="http://FyodorDostoevsky.com">Crime and Punishment</a><li><a href="http://AlexandreDumas.com">The Count of Monte Cristo</a></li></li></li></ul></body></html>>

(2)

Normally the :- operator can be used to reference structure members.

soup:-h1:-string

Great Novels

(3)

The following is equivalent to the above.

EvalMemberEvalMembersoup&comma;h1&comma;string

Great Novels

(4)

Here is a contrived example that will generate an error because link:-text is formed before link has a value

evallink:-text&comma;link=soup:-finda

Using delayed evaluation and EvalMember makes the above work:

evalEvalMemberlink&comma;text&comma;link=soup:-finda

Don Quixote

(5)

Here is an example of using EvalMember to construct a sequence:

seqEvalMemberlink&comma;text&comma;linkinsoup:-find_alla

Don Quixote&comma;Crime and Punishment&comma;The Count of Monte Cristo

(6)

Compatibility

• 

The Python[EvalMember] command was introduced in Maple 2018.

• 

For more information on Maple 2018 changes, see Updates in Maple 2018.

See Also

Python

Python:-EvalString

type/python