From 59cbb7fc0211d2b74008540e5f53dbce606fbd67 Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Fri, 31 Oct 2014 16:07:03 -0400 Subject: add an attribute method to get the value at that attribute --- mop/__init__.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/mop/__init__.py b/mop/__init__.py index 554cc9c..c07b12e 100644 --- a/mop/__init__.py +++ b/mop/__init__.py @@ -227,6 +227,12 @@ def bootstrap(): name="get_body", body=gen_reader("body") )) + def get_value(self, instance): + return instance.slots[self.get_name()] + Attribute.add_method(Method.new( + name="get_value", body=get_value + )) + Class.add_attribute(Attribute.new(name="name")) Class.add_attribute(Attribute.new(name="superclass")) Class.add_attribute(Attribute.new(name="attributes", default=lambda: {})) -- cgit v1.2.3-54-g00ecf