Euler and Python

So, how does the interface work?

As I told you I had troubles with systems, where Python is not installed. Even worse, it had to be Python 2.7, since C code must be linked to a specific Python library. If python27.dll was missing, Windows would not start Euler saying that the DLL was missing. Some users loaded the DLL from the net. But it does not work on its own. Moreover, I warn against using DLLs from strange sources. With the DLL, Euler starts, but attempts to use Python call exit() inside Python and this finishes Euler too. This is an awful behavior, which Python should remove in future versions.

So I start a self made DLL first and link code to it. This DLL (python.dll) communicates with Python later, when it is loaded. Consequently, Euler will start even if Python is not installed. I took the chance to check for an installation of Python. Still, I cannot guarantee that Python will not end Euler. If you install Python 2.7 properly, this should not happen.

The interface has many different ways to use Python. You can send command or multi-line commands to Python with py … Or you can use a function body in Euler with or without a function header to send code to Python.

  • If you use a function header, Euler defines a function in Python, and additionally an Euler function with a Python flag. This function can be called just like any Euler function. You can give it help lines, if you like.
  • If you do not use a function header, the block will be sent to Python verbatim. You can still define a function with „def foo(x): …“, but Euler will not know it. You have to start this function with py$foo(x).

You can also load a Python function simply with „load“.

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert.

Diese Website verwendet Akismet, um Spam zu reduzieren. Erfahre mehr darüber, wie deine Kommentardaten verarbeitet werden.