Macaulay2 » Documentation
Packages » Python » PythonContext » use(PythonContext)
next | previous | forward | backward | up | index | toc

use(PythonContext) -- install variables from a python context

Description

This method makes all the variables in a PythonContext available outside the context.

i1 : ctx = new PythonContext

o1 = ctx

o1 : PythonContext
i2 : ctx "f = lambda x:x**2"
i3 : ctx "x = 5"
i4 : ctx "y = f(x)"
i5 : f

o5 = f

o5 : Symbol
i6 : x

o6 = x

o6 : Symbol
i7 : y

o7 = y

o7 : Symbol
i8 : use ctx
i9 : f

o9 = <function <lambda> at 0x7fb0fcf09620>

o9 : PythonObject of class function
i10 : x

o10 = 5

o10 : PythonObject of class int
i11 : y

o11 = 25

o11 : PythonObject of class int

Ways to use this method:


The source of this document is in Python/doc/context.m2:120:0.