Pymacs, exporting python objects to elisp.
Syver Enstad
syver-en+usenet at online.no
Tue Dec 10 07:47:08 EST 2002
I've been using Pymacs for sometime but always used python functions
from elisp not instances (class objects).
I need to export python instances to elisp with pymacs. How do I do
that?
An example:
class Organisation:
def __init__(self):
self._departments = []
def departments(self):
return self._departments
def addDeparmtent(self, aDepartment):
self._departments.append(aDepartment)
class Department:
def __init__(self, aString):
self._name = aString
def name(self):
self._name
Let's say I build an Organisation on the Python side of Pymacs.
def for_calling_from_emacs_lisp():
org = Organisation()
dept = Department('Sales')
org.addDepartment(dept)
return org
Let's say I want to find the department named Sales from emacs
lisp. How would it look:
(setq org (pymodname-for-calling-from-emacs-lisp))
...Then what..?
Python pseudo code:
for each in org.departments():
if each.name() == 'Sales':
# do stuff
I also thought about the possibility of maybe returning Python
instances as instances of EIEIO classes.
--
Vennlig hilsen
Syver Enstad
More information about the Python-list
mailing list