aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2014-10-31 15:13:07 -0400
committerJesse Luehrs <doy@tozt.net>2014-10-31 15:13:07 -0400
commit0f9a974c968e4c2b08ea34b97646c25bdfc65cc8 (patch)
treea1b55c89fa60d0485aee6bb49e319be2cd6cec9d
parent863bb23f14471e86f9eb47096ed453e31a9b67e4 (diff)
downloadpython-mop-0f9a974c968e4c2b08ea34b97646c25bdfc65cc8.tar.gz
python-mop-0f9a974c968e4c2b08ea34b97646c25bdfc65cc8.zip
more comments
-rw-r--r--mop/__init__.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/mop/__init__.py b/mop/__init__.py
index 783bb6b..eb43fa8 100644
--- a/mop/__init__.py
+++ b/mop/__init__.py
@@ -79,6 +79,10 @@ def bootstrap():
Method = bootstrap_create_class('Method', Object)
Attribute = bootstrap_create_class('Attribute', Object)
+ # this add_method implementation is temporary, since it touches the slots
+ # directly and fiddles with method.__class__ and such - once the full mop
+ # is complete, we won't need to do those things (and they might even be the
+ # wrong things to do), so we will replace it at the end
def add_method(self, method):
name = method.slots["name"]
self.slots["methods"][name] = method
@@ -121,10 +125,12 @@ def bootstrap():
def gen_reader(name):
return lambda self: self.slots[name]
+ # get_mro needs get_superclass
Class.add_method(bootstrap_create_method(
"get_superclass", gen_reader("superclass")
))
+ # get_all_attributes requires get_mro
def get_mro(self):
mro = [ self ]
parent = self.get_superclass()
@@ -135,10 +141,12 @@ def bootstrap():
"get_mro", get_mro
))
+ # get_all_attributes requires get_local_attributes
Class.add_method(bootstrap_create_method(
"get_local_attributes", gen_reader("attributes")
))
+ # create_instance requires get_all_attributes
def get_all_attributes(self):
attributes = {}
for c in reversed(self.get_mro()):
@@ -148,6 +156,7 @@ def bootstrap():
"get_all_attributes", get_all_attributes
))
+ # new requires create_instance
def create_instance(self, kwargs):
slots = {}
for attr_name in self.get_all_attributes():