aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2014-10-31 15:23:50 -0400
committerJesse Luehrs <doy@tozt.net>2014-10-31 15:23:50 -0400
commit04d2eeb8414339856822d0543400c34de289fdde (patch)
tree64f184cb3265ea7744f13be9dd1ef2b90f6ad6f4
parent0f9a974c968e4c2b08ea34b97646c25bdfc65cc8 (diff)
downloadpython-mop-04d2eeb8414339856822d0543400c34de289fdde.tar.gz
python-mop-04d2eeb8414339856822d0543400c34de289fdde.zip
these don't need to be global
-rw-r--r--mop/__init__.py66
1 files changed, 32 insertions, 34 deletions
diff --git a/mop/__init__.py b/mop/__init__.py
index eb43fa8..de649e4 100644
--- a/mop/__init__.py
+++ b/mop/__init__.py
@@ -35,43 +35,41 @@ def python_install_method(c, name, method):
lambda self, *args, **kwargs: method.execute(self, args, kwargs)
)
-# and finally, bootstrap helpers to create hardcoded structures during the
-# bootstrap (which we will inflate into real structures at the end)
-def bootstrap_create_class(name, superclass):
- c = BasicInstance(
- globals().get("Class"),
- {
- "name": name,
- "superclass": superclass,
- "methods": {},
- "attributes": {},
- },
- )
- # need to make sure we call this explicitly with the class name during the
- # bootstrap, since we won't have get_name() yet
- python_class_for(c, name)
- return c
-
-def bootstrap_create_method(name, body):
- return BasicInstance(
- globals().get("Method"),
- {
- "name": name,
- "body": body,
- }
- )
-
-def bootstrap_create_attribute(name):
- return BasicInstance(
- globals().get("Attribute"),
- {
- "name": name,
- }
- )
-
def bootstrap():
# Phase 1: construct the core classes
+ def bootstrap_create_class(name, superclass):
+ c = BasicInstance(
+ globals().get("Class"),
+ {
+ "name": name,
+ "superclass": superclass,
+ "methods": {},
+ "attributes": {},
+ },
+ )
+ # need to make sure we call this explicitly with the class name during
+ # the bootstrap, since we won't have get_name() yet
+ python_class_for(c, name)
+ return c
+
+ def bootstrap_create_method(name, body):
+ return BasicInstance(
+ globals().get("Method"),
+ {
+ "name": name,
+ "body": body,
+ }
+ )
+
+ def bootstrap_create_attribute(name):
+ return BasicInstance(
+ globals().get("Attribute"),
+ {
+ "name": name,
+ }
+ )
+
global Class, Object, Method, Attribute
Class = bootstrap_create_class('Class', None)