|
From: john c. <joh...@ya...> - 2001-08-08 20:46:48
|
> I'm confused again,
>
> I think that in the end simply unplugging the python
> class and plugging
> a java class in would be simpler ...
What happens when one tries to unplug the java class?
Class doesn't work anymore. Also, can't use same code
in cPython because of the java class.
What if one tries to set a new attribute a.foo="foo"
on the jclass. The dynamic behavior is lost. Can't
do it at all because a jclass is entirely static. A
Jython class with a backbone still enables attribute
setting dynamically. It has an ethereal existence in
both the Python world and the Java world.
class EggFarts:
def __init__(self):
self.a = 'a' # defined in skeleton so
# set_a called in skeleton
# backbone
self.b = 'b' # defined in skeleton so
# set_b called on skeleton
# backbone
self.drank_too_much_beer = "advil"
# not defined in skeleton
# so will be set here in the
# EggFarts instance. Skeleton
# class unaware of its
# exisitence.
public class EggFartsSkeleton extends PyObject {
private String a;
private String b;
public void set_a(PyString ob) {
a=ob.internedString();
}
public String get_a() {
return a;
}
public void set_b(PyString ob) {
b=ob.internedString();
}
public String get_b() {
return b;
}
public void get_a() {
return a;
}
Why the getter and setter methods?
Enanbles me to delegate retrieval of the skeleton of
another PyObject in the skeleton class itself.
-john
__________________________________________________
Do You Yahoo!?
Make international calls for as low as $.04/minute with Yahoo! Messenger
http://phonecard.yahoo.com/
|