4.1 Common Interface Functionality

Module: sage.interfaces.expect

See the examples in the other sections for how to use specific interfaces. The interface classes all derive from the generic interface that is described in this section.

Author Log:

Module-level Functions

console( cmd)

is_ExpectElement( x)

reduce_load( parent, x)

Class: Expect

class Expect
Expect interface object.
Expect( self, name, prompt, [command=0], [server=None], [maxread=30], [script_subdirectory=[]], [restart_on_ctrlc=False], [verbose_start=False], [init_code=], [max_startup_time=100000], [logfile=None], [eval_using_file_cutoff=None])

Functions: call,$  $ clear,$  $ clear_prompts,$  $ console,$  $ eval,$  $ expect,$  $ function_call,$  $ get,$  $ get_using_file,$  $ help,$  $ interact,$  $ is_local,$  $ is_remote,$  $ name,$  $ new,$  $ path,$  $ pid,$  $ quit,$  $ set,$  $ user_dir

clear( self, var)

Clear the variable named var.

get( self, var)

Get the value of the variable var.

interact( self)

This allows you to interactively interact with the child interpreter. Press Ctrl-D or type 'quit' or 'exit' to exit and return to SAGE.

Note: This is completely different than the console() member function. The console function opens a new copy of the child interepreter, whereas the interact function gives you interactive access to the interpreter that is being used by SAGE. Use sage(xxx) or interpretername(xxx) to pull objects in from sage to the interpreter.

set( self, var, value)

Set the variable var to the given value.

Special Functions: __call__,$  $ __cmp__,$  $ _assign_symbol,$  $ _change_prompt,$  $ _coerce_,$  $ _contains,$  $ _continuation_prompt,$  $ _create,$  $ _equality_symbol,$  $ _eval_line,$  $ _eval_line_using_file,$  $ _false_symbol,$  $ _get,$  $ _install_hints,$  $ _is_true_string,$  $ _keyboard_interrupt,$  $ _left_list_delim,$  $ _next_var_name,$  $ _object_class,$  $ _post_interact,$  $ _post_process_from_file,$  $ _pre_interact,$  $ _quit_string,$  $ _read_in_file_command,$  $ _repr_,$  $ _right_list_delim,$  $ _send,$  $ _start,$  $ _temp_file,$  $ _true_symbol

__call__( self, x)

Create a new object in self from x.

The object X returned can be used like any SAGE object, and wraps an object in self. The standard arithmetic operators work. Morever if foo is a function then X.foo(y,z,...) calls foo(X, y, z, ...) and returns the corresponding object.

_install_hints( self)

Hints for installing needed slave program on your computer.

There are no hints by default.

Class: ExpectElement

class ExpectElement
Expect element.
ExpectElement( self, parent, value, [is_name=False])

Functions: bool,$  $ gen,$  $ hasattr,$  $ name,$  $ sage

hasattr( self, attrname)

Returns whether the given attribute is already defined by this object, and in particular is not dynamically generated.

Special Functions: __call__,$  $ __contains__,$  $ __float____,$  $ __getitem__,$  $ __int__,$  $ __iter__,$  $ __len__,$  $ __long__,$  $ __pow__,$  $ __reduce__,$  $ __repr__,$  $ _add_,$  $ _check_valid,$  $ _cmp_,$  $ _div_,$  $ _integer_,$  $ _latex_,$  $ _matrix_,$  $ _mul_,$  $ _r_action,$  $ _rational_,$  $ _reduce,$  $ _sage_,$  $ _sage_doc_,$  $ _sub_,$  $ _vector_

_check_valid( self)

Check that this object is valid, i.e., the session in which this object is defined is still running. This is relevant for interpreters that can't be interrupted via ctrl-C, hence get restarted.

_sage_( self)

Attempt to return a SAGE version of this object.

Class: ExpectFunction

class ExpectFunction
Expect function.
ExpectFunction( self, parent, name)

Special Functions: __call__,$  $ __repr__

Class: FunctionElement

class FunctionElement
Expect function element.
FunctionElement( self, obj, name)

Functions: help

Special Functions: __call__,$  $ __repr__,$  $ _sage_doc_

See About this document... for information on suggesting changes.