Pythonic: Difference between revisions

48 bytes added ,  17 April 2016
Line 91: Line 91:
The python object can be manipulated by python calls like {{Codeline|pycall}} and {{Codeline|pyexec}} without needing to do an explicit conversion. For example
The python object can be manipulated by python calls like {{Codeline|pycall}} and {{Codeline|pyexec}} without needing to do an explicit conversion. For example


{{Code|Octave object that points to a python object|<syntaxhighlight lang="octave" style="font-size:13px">
{{Code|Octave object that points to a python object|<syntaxhighlight lang="octave" style="font-size:13px" line>
pyexec ("import networkx as nx")
pyexec ("import networkx as nx")
pyexec ("G=nx.complete_graph(10)")
pyexec ("G=nx.complete_graph(10)")
Line 99: Line 99:
</syntaxhighlight>}}
</syntaxhighlight>}}


'''Comment:''' It seems that {{Codeline|pyexec}} and {{Codeline|pycall}} do not share workspace, so the code above wont work because ''nx'' doesn't exist.
'''Comment:''' It seems that {{Codeline|pyexec}} and {{Codeline|pycall}} do not share workspace, so the code above wont work because ''nx'' doesn't exist when we call {{Codeline|pycall}} at line 4.


The conversion methods should provide different output objects to Octave. The idea is to be able to call something like
The conversion methods should provide different output objects to Octave. The idea is to be able to call something like
657

edits